Hi everyone,

I have this small code below to see if the text selected is a link or not. It works fine but in Firefox I get a null on a link if it is selected from RIGHT to LEFT.
Who can help me out?

Code:
function getInfo()
{
if (document.selection && document.selection.createRange) {

var selection = textEditor.document.selection.createRange(); var tag = selection.parentElement().tagName; var link = selection.parentElement().getAttribute("href");
} else if (window.getSelection) {
var selection = textEditor.window.getSelection(); var node = selection.anchorNode; var tag = node.parentNode.tagName; var link = node.parentNode.getAttribute("href");
} alert('Tagname='+tag+' Link='+link+''); }