Why doesn't this work:

$('a').not('li a').click( function() {
        $(this).remove();
        return false;
}); 

On this code:
<a href="">this is a link</a>
<br /><br />

<li><a href="">a link inside an li tag</a></li>
<li><a href="">and another</a></li>

<br /><br />
<a href="">and finally another link at the bottom</a>

It correctly removes the bottom and top links, but it also removes the two
links found within LI tags, which from the way I read the API it should not.

____________________________________
 
Andy Matthews
Senior Coldfusion Developer
 
Office:  877.707.5467 x747
Direct:  615.627.9747
Fax:  615.467.6249
[EMAIL PROTECTED]
www.dealerskins.com
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jörn Zaefferer
Sent: Monday, January 08, 2007 3:59 PM
To: jQuery Discussion.
Subject: Re: [jQuery] select links not children of li

spinnach schrieb:
> ..how to select all links on a page that are not inside a list (not 
> children of 'li')?..
>   
Untested:
$("a").filter(function() { return !$(this).parents().is("ul "); })

Requires 1.1

--
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to