Answer the question
In order to leave comments, you need to log in
How to get caret position in textarea?
The task arose: when you click on the button (and there are almost 3 dozen of them), text should be inserted into the textarea where the caret is located.
But I don’t know which way to look in order to understand how to solve the problem.
Answer the question
In order to leave comments, you need to log in
let sel = window.getSelection();
let range = sel.getRangeAt(0);
let boundary = range.getBoundingClientRect();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question