[jQuery] select links not children of li

[jQuery] select links not children of li

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
amatthews@dealerskins.com
www.dealerskins.com

-----Original Message-----
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com] 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: