JavaScript detect text offset in node at position
问题 I would like to detect the element and text offset under the specified x and y co-ordinates. Let's say we have such DOM: <p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam quis nisl lectus. Donec euismod dignissim turpis, nec viverra nulla iaculis nec. _Fusce_ mattis orci eget nibh rhoncus auctor at in enim. </p> When the user clicks the mouse just before the word _Fusce_ having the x and y co-ordinates I would like to obtain the offset of the word _Fusce_ in the text node as an