Wrong extraction of .attr("href") in IE7 vs all other browsers?

Posted by EmKay on Stack Overflow See other posts from Stack Overflow or by EmKay
Published on 2009-10-20T08:29:50Z Indexed on 2010/04/21 8:53 UTC
Read the original article Hit count: 194

Filed under:
|
|
|
|

Can it really be true that the attr("href") command for a link is handled very different in IE7 in comparison to all other browsers?

Let's say I have a page at http://example.com/page.html and I have this HTML:

<a href="#someAnchor" class="lnkTest">Link text</a>

and this jQuery:

var strHref = $(".lnkTest").attr("href");

Then in IE7 the value of the strHref variable will be "http://example.com/page.htm#someAnchor" but in other browsers it will be "#someAnchor".

I believe that the last mentioned case is the most correct one, so is it just a case of IE7 being a bad boy or is it a bug in jQuery?

© Stack Overflow or respective owner

Related posts about ie7

Related posts about jQuery