Thanks for the article link, but your proposed change isn't valid JQuery, is it? My exact jQuery code to read in the value looks like this: pageID = $(this).attr("href"); Adding what you suggested to make it $(this)[0].attr("href") will not do anything apart from force the link to be followed.
I think I'm going to have to move the contents of href to rel instead. On Mar 25, 11:43 am, Martijn Houtman <martijn.hout...@gmail.com> wrote: > On Mar 25, 2009, at 4:32 PM, Shane Riley wrote: > > > > > > > I'm wanting to read in the exact string that's contained in an > > anchor's href attribute in order to use it as the POST variable list > > for an Ajax call to a PHP script, however in IE6 and 7 the string read > > from the href attribute ends up being the absolute path, not just the > > href attribute. Here's exactly what's happening: > > > vars = $("a").attr("href"); > > alert(vars); > > > <a href="page=2">This should return "page=2"</a> > > > What I get when running locally in all browsers but IE is what is > > expected, an alert box with page=2 in it. In IE, I get "http:// > > localhost/page=2". Is there some way to get it to behave either one > > way or the other in all browser instances? I really don't want to have > > to detect for IE, then extract what I want from the string if it is. > > http://www.glennjones.net/Post/809/getAttributehrefbug.htmdescribes > the issue and gives a solution. > > $("a")[0].href will probably work consistently. > > Regards, > -- > Martijn.