This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

startOffset

Summary

Retrieves the offset of the starting boundary point relative to the startContainer in the current range.

Property of dom/Rangedom/Range

Syntax

Note: This property is read-only.

var startRangeOffset = range.startOffset;

Return Value

Returns an object of type NumberNumber

the offset value.

Examples

var range = document.createRange();
range.setStart(startNode,startOffset);
range.setEnd(endNode,endOffset);
var startRangeOffset = range.startOffset;

Notes

Remarks

If the boundary point offset is within a container that is not a character data node, the offset is essentially a count based on where it falls between child nodes. For example, the offset is 0 if it falls before the first child and 1 if it is between the first and second child. If the offset is within a character data node container, the value represents 16-bit unit positions.

Syntax

startRangeOffset = range.startOffset;

Standards information

Related specifications

DOM
Living Standard

Attributions