CaretPosition

The CaretPosition interface represents the caret position, an indicator for the text insertion point. You can get a CaretPosition using the Document.caretPositionFromPoint() method.

Instance properties

This interface doesn't inherit any properties.

CaretPosition.offsetNode Read only

Returns a Node containing the found node at the caret's position.

CaretPosition.offset Read only

Returns a long representing the character offset in the caret position node.

Instance methods

CaretPosition.getClientRect

Returns the client rectangle for the caret range.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android
CaretPosition 128 128 20 No No 128 20 No No No 128
getClientRect 128 128 23 No No 128 23 No No No 128
offset 128 128 20 No No 128 20 No No No 128
offsetNode 128 128 20 No No 128 20 No No No 128

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CaretPosition