Hi All,

I'm wondering if anyone might have any thoughts about how to go about this (via jQuery or plain js)...

I have a div with some text in it:

<div id="myDiv">This is some text</div>

I want to be able to obtain the "cursor position" if the user clicks anywhere between letters/words in the div. IE, if they click between the "h" and the "i" in "This", I want to be able to know that they clicked between letters 2 and 3 (or 1 and 2 in an 0-based array).

I don't want to try to get a cursor position in a textarea: the content will be in a div or other non-editable node. I'm not opposed to having to create an invisible textarea dynamically if that might help in some way (can't think of how it might, though).

Any ideas?

Thanks,
Jack


Reply via email to