T
T
Timur Yakhin2018-03-19 16:32:54
JavaScript
Timur Yakhin, 2018-03-19 16:32:54

How to find cursor position in textarea on dragover event?

When selecting text in a textarea, the position of the cursor and selection can be obtained by reading the textarea.selectionStart, textarea.selectionEnd, and textarea.selectionDirection properties (Figure 1).
Further, if you start dragging the selected text, then in addition to the selection, an additional cursor is displayed indicating the position where the selected fragment will be transferred when the transfer is completed (Fig. 2).
Here is the position of this additional cursor I would like to get from the dragover event.
5aafba92b8c3c809698963.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question