[jQuery] select links not children of li
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=553343222-08012007><FONT face=Arial
color=#0000ff size=2>Okay...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=553343222-08012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=553343222-08012007><FONT face=Arial
color=#0000ff size=2>So then why wouldn't THIS work:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=553343222-08012007>$('a').filter('li
a').click( function()
{<BR> $(this).remove();<BR> return
false;<BR>});</SPAN></DIV>
<DIV> </DIV>
<DIV align=left><SPAN style="FONT-SIZE: 14px"><B><FONT face="Century Gothic">
<DIV align=left><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007><FONT face=Arial
size=2>____________________________________</FONT></SPAN></FONT></SPAN></DIV>
<DIV><SPAN class=159130414-05012007><FONT face=Arial size=2><SPAN
class=159130414-05012007></SPAN></FONT></SPAN> </DIV>Andy
Matthews<BR></FONT></B></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><SPAN
style="FONT-SIZE: 8.5pt; FONT-FAMILY: 'Century Gothic'; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA; mso-no-proof: yes">Senior
Coldfusion Developer</SPAN><BR></FONT></SPAN><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic"><FONT color=#808080><IMG alt="" hspace=0
src="cid:553343222@08012007-17B1" border=0><BR></FONT>Office: 877.707.5467
x747<BR>Direct: 615.627.9747<BR>Fax:
615.467.6249</FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><FONT
face="Century Gothic">amatthews@dealerskins.com<BR><A
href="http://www.dealerskins.com/">www.dealerskins.com</A></FONT></SPAN></DIV>
<DIV><SPAN style="FONT-SIZE: 11px"><IMG
src="outbind://93-00000000C239F2861A6CF5419CB9C1C05C69065584E82000/cid:3251103308_839297"></SPAN></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> discuss-bounces@jquery.com
[mailto:discuss-bounces@jquery.com] <B>On Behalf Of </B>Yehuda
Katz<BR><B>Sent:</B> Monday, January 08, 2007 4:29 PM<BR><B>To:</B> jQuery
Discussion.<BR><B>Subject:</B> Re: [jQuery] select links not children of
li<BR></FONT><BR></DIV>
<DIV></DIV>.not(n) only works when n is a filter, like .not(".absolute") or
.not(":visible")... it can not be used to test arbitrary expressions.<BR><BR>--
Yehuda<BR><BR>
<DIV><SPAN class=gmail_quote>On 1/8/07, <B class=gmail_sendername>Andy
Matthews</B> <<A
href="mailto:amatthews@dealerskins.com">amatthews@dealerskins.com</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Why
doesn't this work:<BR><BR>$('a').not('li a').click( function()
{<BR> $(this).remove();<BR> return
false;<BR>});<BR><BR>On this code:<BR><a href="">this is a
link</a> <BR><br /><br /><BR><BR><li><a
href="">a link inside an li tag</a></li><BR><li><a
href="">and another</a></li><BR><BR><br /><br />
<BR><a href="">and finally another link at the
bottom</a><BR><BR>It correctly removes the bottom and top links, but it
also removes the two<BR>links found within LI tags, which from the way I read
the API it should not.
<BR><BR>____________________________________<BR><BR>Andy Matthews<BR>Senior
Coldfusion Developer<BR><BR>Office: 877.707.5467
x747<BR>Direct: 615.627.9747<BR>Fax: 615.467.6249<BR><A
href="mailto:amatthews@dealerskins.com">amatthews@dealerskins.com</A><BR><A
href="http://www.dealerskins.com">www.dealerskins.com</A><BR><BR><BR>-----Original
Message-----<BR>From: <A
href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A>
[mailto: <A
href="mailto:discuss-bounces@jquery.com">discuss-bounces@jquery.com</A>]
On<BR>Behalf Of Jörn Zaefferer<BR>Sent: Monday, January 08, 2007 3:59
PM<BR>To: jQuery Discussion.<BR>Subject: Re: [jQuery] select links not
children of li <BR><BR>spinnach schrieb:<BR>> ..how to select all links on
a page that are not inside a list (not<BR>> children of
'li')?..<BR>><BR>Untested:<BR>$("a").filter(function() { return
!$(this).parents().is("ul "); }) <BR><BR>Requires 1.1<BR><BR>--<BR>Jörn
Zaefferer<BR><BR><A
href="http://bassistance.de">http://bassistance.de</A><BR><BR><BR>_______________________________________________<BR>jQuery
mailing list<BR><A
href="mailto:discuss@jquery.com">discuss@jquery.com</A><BR><A
href="http://jquery.com/discuss/">http://jquery.com/discuss/</A><BR><BR><BR>_______________________________________________<BR>jQuery
mailing list<BR><A href="mailto:discuss@jquery.com">discuss@jquery.com
</A><BR><A
href="http://jquery.com/discuss/">http://jquery.com/discuss/</A><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Yehuda Katz<BR>Web Developer | Wycats
Designs<BR>(ph) 718.877.1325 </BODY></HTML>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/