How to get the tagname and its href of selected anchor text
<p>When I select a link (with no ids or classes) within a paragraph, I need to get the selected links href value. How do I do it in jQuery?  I am using <code>document.getSelection()</code> method for that. But I don't see any method in <code>document.getSelection()</code> which returns the href value.</p>

<p>When I select the link by dragging the mouse, I am able to get the href value like below.</p>

<pre><code>currentLink = document.getSelection().anchorNode.parentElement.href;
</code></pre>

<p>But when I select the link by double clicking the text, the above command will not return the href value. Please help.</p>
