Is there any good JQuery/JS solution to get the absolute position of a caret in text area (given in X/Y coordinates OR top/left coordinates).
The native Event object of keyDown JQuery function gives the x/y coordinates of the cursor and I want something similar the works on the working caret.
My goal is to add a floating HTML element the will be positioned relatively to the working caret position so I need to somehow get its position.
I need the solution to work on TextArea elements but a general solution to any editable html element would be even better!
may be you want replace <textarea>
with <div contenteditable="true">
, it has almost the same behavior, and you can get coordinates by conventional way.