$.validator.setDefaults({ errorElement: "span", errorClass: "help-block", highlight: function (element, errorClass, validClass) { $(element).closest('.form-group').addClass('has-error'); }, unhighlight: function (element, errorClass, validClass) {
$(element) .closest('.form-group') .removeClass('has-error') .addClass('has-success');
}, errorPlacement: function (error, element) { if (element.parent('.input-group').length || element.prop('type') === 'checkbox' || element.prop('type') === 'radio') { error.insertAfter(element.parent()); } else { error.insertAfter(element); } } });
References:
https://stackoverflow.com/questions/18754020/bootstrap-3-with-jquery-validation-plugin
https://stackoverflow.com/questions/22483317/jquery-validate-doesnt-add-success-class