How to retrieve the position of selected text by calculating it's offset immediate after body tag?
For Example consider the following html,
<body> <div>hi</div> <div>dude!</div> </body>
on selecting from i (in hi) to du (in dude), I need to get 2 as start position & 4 as end position.
Note: Ignore the tag elements.
Javascript is preferable!