I have a <div>
which contains some text along these lines:
<div id='log'>alpha bravo charlie delta echo foxtrot</div>
When a user clicks on the text, is there a way to determine which word they clicked upon? I was assuming it would be in the event object, but I am unable to locate any such info there.
$('#log').mouseup(function (ev) { // tried .click() also
ev.something ???
});
Note: each word has been added to the <div>
individually, so they are their own TextNode in the DOM. Also, for other reasons in this app, it would be preferable not to have to wrap each word in a <span>...</span>
if there is any other way. The app uses jQuery, but plain javascript is fine too.