What about: $("#idOfAnAnchor1")[0].href;
On Dec 5, 8:10 am, Matthias Coy <[EMAIL PROTECTED]> wrote: > Hi there, > > how do I access the "href"-property of an anchor-element? I know there is a > > $("#idOfAnAnchor").attr("href"); > > but this only gives me the attribute and not the property. I need the > property, because inside of this property is the full URL. See example: > > <a id="idOfAnAnchor1" href="/index.php">Home</a> // on otherpage.com > <a id="idOfAnAnchor2" href="http://somepage.com/index.php">Home</a> > > $("#idOfAnAnchor1").attr("href"); // gives '/index.php', needed is > 'http://otherpage.com/index.php' > $("#idOfAnAnchor2").attr("href"); // gives 'http://somepage.com/index.php' > > I could use: > > var aLink = document.getElementById("#idOfAnAnchor1"); > var aHrefProperty = aLink.href; > > but where is the jQuery fun in this :) ? > > Regards > Matthias