I want to insert an element (span, div, etc.) at a position determined by the user's choice of text in the document.
I managed to get the element on which the choice was made. But I canโt get the exact position in which the choice is made.
For example:
<span>this is testing string for testing purpose</span>
In this case, suppose the user selects the second word "testing". I want it to be replaced as
<span>this is testing string for <b>testing</b> purpose</span>
How should I do it?
By the way: I know that this is possible. Google Wave does it. I just don't know how to do this.
javascript dom html
Rajesh Jul 29 '10 at 13:06 on 2010-07-29 13:06
source share