Javascript get range compared to a parent element
问题 I have a function that return an array (won't work in IE) with two elements the html code of what the user select inside a div (id=text) the range of the selection In case the user select a simple string inside the text div the range return the correct values but when the user select a string inside an element child of div (div#text->p for example) range's values are related to the child element but i want them to be related to the parent (div#text) Here there's a JsFiddle http://jsfiddle.net