I have a registration form that is validated via jQuery Validate and while
the form catches errors properly and displays the validation error message,
it doesn't use my "label label-important" class until I force the
validation/click the submit button* a second time*.
Test it here: http://jsbin.com/uguwem/12/
Here's my js code:
$('#registrationform').validate({
highlight: function (element, errorClass, validClass) {
$(element).parents("div[class='control-group']").addClass("error");
$(element.form).find("span[for=" + element.id + "]").addClass("label label-important");
},
unhighlight: function (element, errorClass, validClass) {
$(element).parents(".error").removeClass("error");
},
errorElement: 'span'
});