Don't klnow what happen there, got submitted when I was not done, excuse the broken fingers. The code is obviously not write...
On Apr 9, 12:37 pm, Gilles <[email protected]> wrote: > I would prefer Mike 2nd approach, not sure the this.each is required > if it does the job without it, it's just adding on top. > > Personally I like the findParent(e,i) idead as when you need only few > nodes it should improve performance a bit > > Query.fn.findParent = function( i ) { > > return this.each(function(){ > $(this).addClass(cls).siblings('.'+cls).removeClass(cls); > }) > }; > > On Apr 8, 3:53 pm, Nicolas R <[email protected]> wrote: > > > radioClass is quite a good idea. Could also be written as > > > Query.fn.radioClass = function( cls ) { > > return this.each(function(){ > > $(this).addClass(cls).siblings('.'+cls).removeClass(cls); > > }) > > }; > > > On Apr 6, 2:12 am, "Michael Geary" <[email protected]> wrote: > > > > Here's an implementation of .radioClass(). I haven't tested it, but it's > > > so > > > simple it's likely to work. :-) > > > jQuery.fn.radioClass = function( cls ) { > > > this.addClass(cls).siblings().removeClass(cls); > > > return this; > > > }; > > > > Or alternatively, I think this would work too: > > > jQuery.fn.radioClass = function( cls ) { > > > return this.addClass(cls).siblings().removeClass(cls).end(); > > > }; > > > -Mike > > > > _____ > > > > From: Cloudream > > > > .radioClass > > > Add class in one element and remove that same class if it exists from all > > > of > > > its siblings in one call. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
