collapseToEnd method (selectionRange)
Moves the start point of the current selectionRange object to its end point.
Note: The selectionRange object and its collapseToEnd method are supported in Internet Explorer from version 9.The selectionRange object represents the current selection.
If the direction of the selection is left-to-right, then the start point is the anchor point, else the focus point. When the anchor and focus points are at the same position, then no content is selected.To move the end point to the start point, use the collapseToStart method. Use the anchorNode, anchorOffset, focusNode and focusOffset properties to retrieve the boundary points and the isCollapsed property to detect whether a selectionRange object is collapsed.
You can find the related objects in the Supported by objects section below.
This method has no return value.
Example HTML code 1:
This example illustrates the use of the collapseToEnd method:
Did you find this example helpful?
User Contributed Comments