Hi Am,
.attr('href') is supposed to return the actual href attribute of the
link. This was "normalized" quite a few versions ago. Can you tell us
which version you are using?
Also, you can really simplify your selector this way:
jQuery('div.node a').each(function(i) { // etc.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 2, 2007, at 1:23 AM, Am Khan wrote:
Hello,
I wrote a script that starts like this:
jQuery('/html/body//[EMAIL PROTECTED]//a').each(function(i){
var $hr = jQuery(this).attr("href");
.....)};
What I noticed is the following for relative (ex: href="/mypage")
URLs:
var $hr = this.href; //returns URL with http:// (ex:
http://mysite/mypage)
However:
var $hr = jQuery(this).attr("href"); //returns URL with
http://
(ex: http://mysite/mypage)
in ie6 and actual URL (ex: /mypage)
in firefox.
I am confused, I really appreciate if anyone can explain this
behavior. And let me know how I can get the actual URL in both
browser.
Thanks and reagards,
AK