startOffset property (Range)
Returns an integer that specifies the start position of the current Range relative to the startContainer element.
Note: The Range object and its startOffset property are supported in Internet Explorer from version 9.If the node referred to by the startContainer property is a TextNode, CDATASection or CommentNode, then the startOffset property returns a character position in the text content of the referred node. For other node types, the returned value is an index into the childNodes collection of the node.
- If you want to modify the start or end point, use the setStart / setStartBefore / setStartAfter and the setEnd / setEndBefore / setEndAfter methods.
- If you want to align the boundary points of a Range to the start and end points of an element or its contents, use the selectNode or selectNodeContents method.
You can find the related objects in the Supported by objects section below.
This property is read-only.
Integer that represents the start position.
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the startOffset property:
Did you find this example helpful?
User Contributed Comments