<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks for the reply Klaus
Both links matches if I, inside the function, do: if (this.href == src)
and when I run the script and watch the output of the alert they also
match. I tried your tip just to be sure though but it still doesn't
exclude the matching href :-/
Did'nt know that different browsers gave a different href reply in
javascript if the links are relative though - thanks for the tip!
Regards
Jimmy
<blockquote cite="mid44FDD865.7080603@stilbuero.de" type="cite">
<pre wrap="">
Mogrol schrieb:
</pre>
<blockquote type="cite">
<pre wrap="">Hi
I'm trying to get all links from the body in a page and in the same time
excluding a single element with the matching href attribute using the
:not css-selector but it does'nt seem to be working.
Is this not supported in the latest jQuery (1.0.1) or is there
something wrong with my code? The expression returns all links matching
the rel but also returns the one with the matching href.
I know I could simply insert a: if (this.href != src) in the function to
fix this but for my purposes the best way to do it is directly using jquery.
I'd be grateful for advices on this.
---
$('body a[@rel=' + rel + ']:not([@href=' + src +'])').each(function() {
alert(this.href + '\n' + src);
});
</pre>
</blockquote>
<pre wrap=""><!---->
Hi, maybe you ran into the problem that different browsers return
different values for the href attribute if the value itself (in your
html source) is a relative link.
If src is something like "/relative/path/to/somewhere" try the following
snippet:
$('a[@rel=' + rel + ']:not([@href$=' + src +'])').each(function() {
alert(this.href + '\n' + src);
});
I think you can leave out the body selector here, links cannot occur
outside the body anyway.
Or you can try to use the not function, but this should have the same
result:
$('a[@rel=' + rel + ']).not('[@href$=' + src +'])').each(function() {
alert(this.href + '\n' + src);
});
-- Klaus
_______________________________________________
jQuery mailing list
<a class="moz-txt-link-abbreviated" href="mailto:discuss@jquery.com">
discuss@jquery.com</a>
<a class="moz-txt-link-freetext" href="http://jquery.com/discuss/">
http://jquery.com/discuss/</a> </pre>
</blockquote>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.comhttp://jquery.com/discuss/