rangeParent property (event)
Returns a reference to the element where the selection ends.
The rangeParent and rangeOffset properties together specify the end position of the selection. The use of them is not recommended.
A more useful solution is to create a selectionRange object from the current selection with the getSelection method. The selectionRange object is widely supported and provides various information about the current selection.For example the focusNode and focusOffset properties together specify the end position of the selection. The example below illustrates it.
You can find the related objects in the Supported by objects section below.
This property is read-only.
Reference to the element where the selection ends.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the focusNode property instead of the rangeOffset property:
Did you find this example helpful?
User Contributed Comments