Skip to content
Advertisement

Tag: selection-api

Get contentEditable caret position

I’m finding tons of good, cross-browser answers on how to set the caret position in a contentEditable element, but none on how to get the caret position in the first place. What I want to do is know the caret position within a div on keyup. So, when the user is typing text, I can, at any point, know the

Advertisement