Selection: focusOffset property
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The Selection.focusOffset read-only property returns the
number of characters that the selection's focus is offset within the
Selection.focusNode if said node is of type Text, CDATASection or Comment.
In the case of Selection.focusNode being another type of node, Selection.focusOffset returns the number of Node.childNodes the selection's focus is offset within the Selection.focusNode.
This number is zero-based. If the selection ends with the first character in the
Selection.focusNode, 0 is returned.
Value
A number.
Specifications
| Specification |
|---|
| Selection API> # dom-selection-focusoffset> |
Browser compatibility
Loading…
See also
Selection, the interface it belongs to.