Selection: anchorOffset property

The Selection.anchorOffset read-only property returns the number of characters that the selection's anchor is offset within the Selection.anchorNode.

This number is zero-based. If the selection begins with the first character in the Selection.anchorNode, 0 is returned.

Value

A number.

Specifications

Specification
Selection API
# dom-selection-anchoroffset

Browser compatibility

desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
anchorOffset

See also