CaretPosition

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

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.

Methods

CaretPosition.getClientRect

Returns the client rectangle for the caret range.

Specifications

Browser compatibility

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

See also

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