I want to display something e.g div under text area where user typing
I managed to obtain where he's currently typing via selectionStart/End
, but how can I actually calculate coordinates (x,y) of his cursor?
I suppose there are other ways of achieving that than these two:
Calculating in which row user is (based on font size, text area width and characters count in that text area).
x as
textarea.X + selectionStart
in this row
y astextarea.Y + rows * font size
I found this, but it is almost 10 years old