I have the following code which adds custom css styles to my form when using the jQuery validation plugin.
$(document).ready(function() {
jQuery.validator.setDefaults({
errorPlacement: function(error, element) {
// Adds the red outline
element.parent().addClass("error");
// Adds the red cross
element.siblings(".error_status").addClass('check');
// Removes the default error
element.removeClass("error");
}
});
$("#form").validate();
});
Which styles the following html for each element:
<div class="row">
<label for="id-3"><span>Email address:</span><span class="mark">*</span>
<input type="text" class="text required" id="id-3" name="email"/>
<span class="error_status"></span>
</div>
The problem I'm having is that I don't know how to subsequently remove the styles after a successful validation.