Re: [jQuery] select links not children of li
Ooooh... I think I see now. You're saying that once I get a jQuery object, I can filter out children of that object but not parents? Can you give me a quick example Jörn? 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 5:18 PM To: jQuery Discussion. Subject: Re: [jQuery] select links not children of li Andy Matthews schrieb: > Then I guess I'm not understanding what a filter is then. The API for > not() says this: > > "Removes the specified Element from the set of matched elements." > > The API for filter() says this: > > "Removes all elements from the set of matched elements that do not > match the specified expression." > > That seems to me like it should work. > > $('a') // select all a elements > $('a').not('li a') // that are not children of an LI tag Then the API is wrong. filter() (and it's inversion, not()), can only handle expressions down the tree, not upwards. In other words: It can only check for attributes or child elements, but has no idea of the context the element is in. -- 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/
Re: [jQuery] select links not children of li
it should probably be "return this.set", not "return jQuery.set", if i'm right?.. Yehuda Katz wrote: > And John's better alternative: > > $.fn.notFind = function(obj) { > if ( obj.constructor == String ) obj = $(obj); > return jQuery.set( jQuery.grep(this, function(i) { return obj.index(i) > == -1 }) ); > }; > > On 1/8/07, *Yehuda Katz* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: > > Make that > > $.fn.notFind = function(obj) { > if(typeof obj == "string") return $.map(this, function(i) { return > $(obj).index(i) == -1 ? i : null }) > else if(obj.jquery) return $.map(this, function(i) { return > obj.index(i) == -1 ? i : null }) > > } > > On 1/8/07, * Yehuda Katz* < [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > You could do something like this: > > $.fn.notFind = function(obj) { > if(typeof obj == "string") return $.map(this, function(i) { > return $(obj).index(i) == -1 ? i : null }) > else if(obj.jquery) return $.map(obj, function(i) { return > obj.index(i) == -1 ? i : null }) > } > > then you could do $("a").notFind("li a") > > -- Yehuda > > > > On 1/8/07, *Yehuda Katz* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > .not(n) only works when n is a filter, like > .not(".absolute") or .not(":visible")... it can not be used > to test arbitrary expressions. > > -- Yehuda > > > On 1/8/07, * Andy Matthews* <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > Why doesn't this work: > > $('a').not('li a').click( function() { > $(this).remove(); > return false; > }); > > On this code: > this is a link > > > a link inside an li tag > and another > > > and finally another link at the bottom > > 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] <mailto:[EMAIL PROTECTED]> > www.dealerskins.com <http://www.dealerskins.com> > > > -Original Message- > From: [EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> [mailto: > [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 <mailto:discuss@jquery.com> > http://jquery.com/discuss/ > > > ___ > jQuery mailing list > discuss@jquery.com <mailto:discuss@jquery.com> > http://jquery.com/discuss/ > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > > > > > ___ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
Andy Matthews schrieb: > Then I guess I'm not understanding what a filter is then. The API for > not() says this: > > "Removes the specified Element from the set of matched elements." > > The API for filter() says this: > > "Removes all elements from the set of matched elements that do not > match the specified expression." > > That seems to me like it should work. > > $('a') // select all a elements > $('a').not('li a') // that are not children of an LI tag Then the API is wrong. filter() (and it's inversion, not()), can only handle expressions down the tree, not upwards. In other words: It can only check for attributes or child elements, but has no idea of the context the element is in. -- Jörn Zaefferer http://bassistance.de ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
Then I guess I'm not understanding what a filter is then. The API for not() says this: "Removes the specified Element from the set of matched elements." The API for filter() says this: "Removes all elements from the set of matched elements that do not match the specified expression." That seems to me like it should work. $('a') // select all a elements $('a').not('li a') // that are not children of an LI tag Andy Matthews Senior Coldfusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED] www.dealerskins.com <http://www.dealerskins.com/> _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yehuda Katz Sent: Monday, January 08, 2007 4:42 PM To: jQuery Discussion. Subject: Re: [jQuery] select links not children of li And John's better alternative: $.fn.notFind = function(obj) { if ( obj.constructor == String ) obj = $(obj); return jQuery.set( jQuery.grep(this, function(i) { return obj.index(i) == -1 }) ); }; On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: Make that $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(this, function(i) { return obj.index(i) == -1 ? i : null }) } On 1/8/07, Yehuda Katz < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: You could do something like this: $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(obj, function(i) { return obj.index(i) == -1 ? i : null }) } then you could do $("a").notFind("li a") -- Yehuda On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: .not(n) only works when n is a filter, like .not(".absolute") or .not(":visible")... it can not be used to test arbitrary expressions. -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: Why doesn't this work: $('a').not('li a').click( function() { $(this).remove(); return false; }); On this code: this is a link a link inside an li tag and another and finally another link at the bottom 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 <mailto:discuss@jquery.com> http://jquery.com/discuss/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 att118dd.bmp Description: Windows bitmap ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
Because "li a" is not a "filter" ;) -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: Okay... So then why wouldn't THIS work: $('a').filter('li a').click( function() { $(this).remove(); return false; }); * Andy Matthews *Senior Coldfusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED] www.dealerskins.com -- *From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On Behalf Of *Yehuda Katz *Sent:* Monday, January 08, 2007 4:29 PM *To:* jQuery Discussion. *Subject:* Re: [jQuery] select links not children of li .not(n) only works when n is a filter, like .not(".absolute") or .not(":visible")... it can not be used to test arbitrary expressions. -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > Why doesn't this work: > > $('a').not('li a').click( function() { > $(this).remove(); > return false; > }); > > On this code: > this is a link > > > a link inside an li tag > and another > > > and finally another link at the bottom > > 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/ > -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
And John's better alternative: $.fn.notFind = function(obj) { if ( obj.constructor == String ) obj = $(obj); return jQuery.set( jQuery.grep(this, function(i) { return obj.index(i) == -1 }) ); }; On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: Make that $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(this, function(i) { return obj.index(i) == -1 ? i : null }) } On 1/8/07, Yehuda Katz < [EMAIL PROTECTED]> wrote: > > You could do something like this: > > $.fn.notFind = function(obj) { > if(typeof obj == "string") return $.map(this, function(i) { return > $(obj).index(i) == -1 ? i : null }) > else if(obj.jquery) return $.map(obj, function(i) { return obj.index(i) > == -1 ? i : null }) > } > > then you could do $("a").notFind("li a") > > -- Yehuda > > > On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: > > > > .not(n) only works when n is a filter, like .not(".absolute") or > > .not(":visible")... it can not be used to test arbitrary expressions. > > > > -- Yehuda > > > > On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > > > > > Why doesn't this work: > > > > > > $('a').not('li a').click( function() { > > > $(this).remove(); > > > return false; > > > }); > > > > > > On this code: > > > this is a link > > > > > > > > > a link inside an li tag > > > and another > > > > > > > > > and finally another link at the bottom > > > > > > 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/ > > > > > > > > > > > -- > > Yehuda Katz > > Web Developer | Wycats Designs > > (ph) 718.877.1325 > > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
Make that $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(this, function(i) { return obj.index(i) == -1 ? i : null }) } On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: You could do something like this: $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(obj, function(i) { return obj.index(i) == -1 ? i : null }) } then you could do $("a").notFind("li a") -- Yehuda On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: > > .not(n) only works when n is a filter, like .not(".absolute") or > .not(":visible")... it can not be used to test arbitrary expressions. > > -- Yehuda > > On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > > > Why doesn't this work: > > > > $('a').not('li a').click( function() { > > $(this).remove(); > > return false; > > }); > > > > On this code: > > this is a link > > > > > > a link inside an li tag > > and another > > > > > > and finally another link at the bottom > > > > 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/ > > > > > > -- > Yehuda Katz > Web Developer | Wycats Designs > (ph) 718.877.1325 > -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
Okay... So then why wouldn't THIS work: $('a').filter('li a').click( function() { $(this).remove(); return false; }); Andy Matthews Senior Coldfusion Developer Office: 877.707.5467 x747 Direct: 615.627.9747 Fax: 615.467.6249 [EMAIL PROTECTED] www.dealerskins.com <http://www.dealerskins.com/> _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Yehuda Katz Sent: Monday, January 08, 2007 4:29 PM To: jQuery Discussion. Subject: Re: [jQuery] select links not children of li .not(n) only works when n is a filter, like .not(".absolute") or .not(":visible")... it can not be used to test arbitrary expressions. -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: Why doesn't this work: $('a').not('li a').click( function() { $(this).remove(); return false; }); On this code: this is a link a link inside an li tag and another and finally another link at the bottom 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 <mailto:discuss@jquery.com> http://jquery.com/discuss/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 attda697.bmp Description: Windows bitmap ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
You could do something like this: $.fn.notFind = function(obj) { if(typeof obj == "string") return $.map(this, function(i) { return $(obj).index(i) == -1 ? i : null }) else if(obj.jquery) return $.map(obj, function(i) { return obj.index(i) == -1 ? i : null }) } then you could do $("a").notFind("li a") -- Yehuda On 1/8/07, Yehuda Katz <[EMAIL PROTECTED]> wrote: .not(n) only works when n is a filter, like .not(".absolute") or .not(":visible")... it can not be used to test arbitrary expressions. -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: > > Why doesn't this work: > > $('a').not('li a').click( function() { > $(this).remove(); > return false; > }); > > On this code: > this is a link > > > a link inside an li tag > and another > > > and finally another link at the bottom > > 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/ > -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] select links not children of li
.not(n) only works when n is a filter, like .not(".absolute") or .not(":visible")... it can not be used to test arbitrary expressions. -- Yehuda On 1/8/07, Andy Matthews <[EMAIL PROTECTED]> wrote: Why doesn't this work: $('a').not('li a').click( function() { $(this).remove(); return false; }); On this code: this is a link a link inside an li tag and another and finally another link at the bottom 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/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [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: this is a link a link inside an li tag and another and finally another link at the bottom 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/
Re: [jQuery] select links not children of li
You'd use a custom filter: $("a").filter(function(elem){ return $(elem).parent("li").length == 0; }) On 1/8/07, spinnach <[EMAIL PROTECTED]> wrote: ..how to select all links on a page that are not inside a list (not children of 'li')?.. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Yehuda Katz Web Developer | Wycats Designs (ph) 718.877.1325 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
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/
Re: [jQuery] select links not children of li
Should be: $('a').not('li a'); 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 spinnach Sent: Monday, January 08, 2007 3:38 PM To: jQuery Discussion. Subject: [jQuery] select links not children of li ..how to select all links on a page that are not inside a list (not children of 'li')?.. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] select links not children of li
..how to select all links on a page that are not inside a list (not children of 'li')?.. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/