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: > <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] <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/