It goes like this:
I need to get the position of the selected text in an element.
The element is not a textarea.
I know how to get the selected text, but not the position.
The farthest I got was this:
I can get the selected text, then get the index of it in the element’s content.
However, this method is useless when I have more than one occurrence of the selected text.
So, how can I get the starting position of the selected text, in a non-textarea element?
I googled this problem, but didn’t find a single answer to it.
Maybe I just didn’t look hard enough (please link me if you know where I can get the answer).