http://www.codetoad.com/javascript_get_selected_text.asp http://javascript.internet.com/page-details/highlighted-text.html But now I am thinking thats not what you where after... you don't want the selected text, but rather the id/name of its parent element? Maybe http://forums.asp.net/p/1533440/3717868.aspx
On Tue, Sep 21, 2010 at 9:23 PM, Jordan Schatz <[email protected]> wrote: > I haven't ever done it but there are plenty of javascript text editin > widgets (and they must be able to tell what text is selected, at least > within a text or input field) I would have a look at the jQuery > WYSIWYG editor's source. > > Just my two bits : ) > -Jordan > > On Tue, Sep 21, 2010 at 9:17 PM, Jonathan Duncan > <[email protected]> wrote: >> >> On 21 Sep 2010, at 19:40, Wade Preston Shearer wrote: >> >>> Using javascript, it is possible to get the HTML element(s) that selected >>> text are contained within? And by selected text, I mean text that you >>> selected with the mouse (cursor). >>> >> >> That might be tricky. From what I understand the text highlighting is a >> system level activity. I think the only way to do this would be to watch >> the document for a onmousedown, then check cursor position, then onmouseup, >> and check cursor position again. Just my quick thoughts. Have not googled >> it. >> >> >> _______________________________________________ >> >> UPHPU mailing list >> [email protected] >> http://uphpu.org/mailman/listinfo/uphpu >> IRC: #uphpu on irc.freenode.net >> > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
