Mogrol schrieb:
> 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 [EMAIL PROTECTED]' + rel + ']:not([EMAIL PROTECTED]' + src 
> +'])').each(function() {
>    alert(this.href + '\n' + src);
> });


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:

$('[EMAIL PROTECTED]' + rel + ']:not([EMAIL PROTECTED]' + 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:

$('[EMAIL PROTECTED]' + rel + ']).not('[EMAIL PROTECTED]' + src 
+'])').each(function() {
     alert(this.href + '\n' + src);
});


-- Klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to