Is there any better way to rewrite this:
$('element').removeClass('class1').removeClass('class2');
Can't use removeClass(); as it would remove ALL classes, which I don't want.
Thanks
Is there any better way to rewrite this:
$('element').removeClass('class1').removeClass('class2');
Can't use removeClass(); as it would remove ALL classes, which I don't want.
Thanks
err .. $('element').removeClass('class1 class2');
?
check here
http://docs.jquery.com/Attributes/removeClass
One or more CSS classes to remove from the elements, these are separated by spaces.
$("element").removeClass("class1 class2");
From removeClass()
, the class parameter:
One or more CSS classes to remove from the elements, these are separated by spaces.
The documentation says:
class (Optional) String
One or more CSS classes to remove from the elements, these are separated by spaces.
Example:
Remove the class 'blue' and 'under' from the matched elements.
$("p:odd").removeClass("blue under");