This question may be similar to
How to find the selection text beginning and end positions in Javascript?
But it is a little different.
I have a div like this-
<div class="text-block title">
ve <i><u>ri</u> <b>t</i>us</b> anything anything hi hello bla bla
</div>
What I am trying to do is if a user selects this text like this-
Then I want to get the index of the selected text's starting and ending (for this condition 4,17).
Is there any way?
Thanks in advance for helping..