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
-~----------~----~----~----~------~----~------~--~---