how would I use .removeClass to remove all matching classes instead of calling out each element individually?
So instead开发者_如何学JAVA of this:
$("input").removeClass("CO_form_alert");
$("select").removeClass("CO_form_alert");
$("input, select").removeClass("CO_form_alert");
or even
$(".CO_form_alert").removeClass("CO_form_alert");
Hint: jQuery always works on all selected elements.
$(".CO_form_alert").removeClass("CO_form_alert");
why couldn't you just use the following to do as you asked remove the class from all elements (versus a single defined element)
$(".CO_form_alert").removeClass("CO_form_alert");
You can specify any number of selectors to perform the removeClass on:
$("select, input, banana").removeClass("CO_form_alert");
精彩评论