I am trying to figure out the offset of a selection from a particular node with javascript.
Say I have the following HTML
you can use the following java script code:
var text = window.getSelection(); var start = text.anchorOffset; alert(start); var end = text.focusOffset - text.anchorOffset; alert(end);