Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

collapse method

Replaces the current selection with an empty selection (or a caret) at the given offset.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 7.6.1Internet Explorer 9


HRESULT retVal = object.collapse(parentNode, offset);


parentNode [in]

Type: IDispatch

The parent node that the selection is contained in.

offset [in]

Type: long

The number of units from the start in which to place the caret or collapsed selection.

Return value


If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information


Raises a WrongDocumentError DOMException if the parentNode is in another document. Versions earlier than Internet Explorer 10 will throw the exception as WRONG_DOCUMENT_ERR.



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.