[jQuery] swapClass
[jQuery] swapClass
I'm not sure how helpful this will be to anybody, but i thought i would post it to the list anyway.
jQuery.fn.swapClass = function(c1, c2){
return this.each(function(){
var t = $(this);
(
t.is('.'+c1)) ?
t.addClass(c2).removeClass(c1) : t.addClass(c1).removeClass(c2);
});
}
I've found this to be pretty helpful, so i thought i would contribute it to the group.
Also i would like to know if this is the most efficient this code could be.
Thanks,
Wil
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/