javascript - Get link if user selected text is contained within a link -
okay, trying figure out how link href if user has highlightened text contained within text...
so illustration if next link
<a href="http://www.google.com">find on google</a>
and user hightlights text "google"
<a href="http://www.google.com">find on google</a>
so question is: after user highlights text (as in re-create , paste it) nail button , homecoming link selected text.
i hope made clear, wasn't sure how phrase it.
window.getselection().anchornode.parentnode.href;
or in ie:
document.selection.createrange().parentelement().href;
should element's href text selected ?
javascript jquery
No comments:
Post a Comment