I experienced the same problem while developing a plugin that does
some tricks with the page content during the ready event. I noticed
that attr('href') works fine if I don't manipulate the body tag
content. IE won't return the correct href attribute if I do so.
The code I used to workaround the
Right, it's not hard, it was just unexpected is all. I guess I've
gotten used to JQuery working the same in all browsers.
I've got it working now with some old-fashioned Javascript. Thanks!
On Mar 25, 3:20 pm, Shane Riley wrote:
> Alright, so your example shows the actual strings for all three
Well, the string manipulation is pretty minimal. Just use
this.pathname -- or some combination of this.pathname, this.hash, and
this.search if necessary.
The one problem with this.pathname is that IE and Opera omit the
initial slash while FF and Safari include it. But that's not hard to
Alright, so your example shows the actual strings for all three values
in Safari, and in IE7(Vista) it shows the absolute path for #3. After
looking back at my code, I'm actually loading in the links via Ajax
when the page is loaded, so they're not in the original document. So
I'm guessing that me
Hi Shane,
Yes, I believe you're reading me right. Strange, though. I'm not able
to reproduce the problem you're having. Take a look here:
http://test.learningjquery.com/href.html
In IE 7 for #1 and #2 $(this).attr('href') is reporting the actual
text string of the href attribute while this
After replacing $(this).attr("href") with this.getAttribute("href", 2)
I get the same result. If I output the attribute, IE still shows the
absolute path.
On Mar 25, 2:21 pm, Shane Riley wrote:
> Karl, I'm pretty sure I'm reading you right, but are you saying that
> by all accounts JQuery should
Karl, I'm pretty sure I'm reading you right, but are you saying that
by all accounts JQuery should account for this and return the string-
literal value of href and not IE's absolute path? If so, it's not
working properly. I wish I could show you the live code, because it's
probably easier to visu
Hi Shane,
IE has a second "flag" argument for getAttribute that, when set to 2,
is supposed to get the literal value of the attribute rather than
their special-sauce value.
So, this.getAttribute('href', 2) *should* get the relative href.
(note: no need to do $(this)[0] ; this works just f
Ha! I looked at your post too fast, and didn't notice that it was pure
Javascript. Sorry. I'll try it and see.
The way I currently have it will not work with javascript turned off
either. I'm doing it this way only because the client is requiring the
user to have Javascript enabled to use the sit
On Mar 25, 2009, at 5:04 PM, Shane Riley wrote:
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 anyt
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
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 a
12 matches
Mail list logo