Remove class using jQuery

Yip:

$(this).removeClass('er-green');
$(this).addClass('er-red');

Or remove them all first:

If a class name is included as a parameter, then only that class will be removed from the set of matched elements. If no class names are specified in the parameter, all classes will be removed.

$(this).removeClass();
$(this).addClass('er-red');

Leave a Comment