I have created a contentEditable editor and I need to get the pixel position of the cursor so I can position a menu by it. (As the user types a special string, a menu opens automatically to show a hint).
I have this all working except I don't know how to get the actual pixel position of the cursor to position the menu. The best I've been able to do is get the current node the cursor is in, but I still don't know where the cursor is "within" this element.
↓ I can get the position of this div easily enough
<div>I am typing a message |</div>
↑ But I need the position of the cursor here
Edit: I can confirm that using the Range like you would in a textarea also works for ContentEditable.