Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Replaces the current selection with an empty selection (or a caret) at the given offset.
![]() ![]() |
Syntax
HRESULT retVal = object.collapse(parentNode, offset);
Parameters
parentNode [in]
Type: IDispatchThe parent node that the selection is contained in.
offset [in]
Type: longThe number of units from the start in which to place the caret or collapsed selection.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Standards information
- HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 7.6.1
Remarks
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.