Let's assume there is a text-area (or a simple input of type text) and the user types something.
How can I get the x / y
coordinates of the cursor to position, as example, a div
direct above the cursor.
Asked
Active
Viewed 175 times
0

Simon
- 2,686
- 2
- 31
- 43
-
You can use `selectionStart`, like answered here : https://stackoverflow.com/questions/4928586/get-caret-position-in-html-input For textAreas, you can get the coordinated by counting the caracters (for example). – Seblor Jun 20 '18 at 13:22
-
Try window.getSelection – Sumesh TG Jun 20 '18 at 13:26
-
try to use event.target inside the key down event for the textbox – mbadeveloper Jun 20 '18 at 14:48