I have a project that uses Bootstrap 3.3.4, Select2 4.0, and Jquery Validation 1.13.1
I have set the jquery validator defaults to style bootstrap 3 classes like so
$.validator.setDefaults({
errorElement: "span",
errorClass: "help-block",
highlight: function (element, errorClass, validClass) {
$(element).addClass(errorClass);
$(element).closest('.form-group').removeClass('has-success').addClass('has-error');
},
unhighlight: function (element, errorClass, validClass) {
$(element).removeClass(errorClass);
$(element).closest('.form-group').removeClass('has-error').addClass('has-success');
},
errorPlacement: function(error, element) {
if(element.parent('.input-group').length) {
error.insertAfter(element.parent());
} else {
error.insertAfter(element);
}
}
});
But these defaults do not style select2 fields the same... in the image below, the "metals" select is a bootstrap field, while the "colors" select is a select2 field.
I tried searching other SO's , but all of these use the 3.5.xx version of select2
I included a jsfiddle of the example pictured, I am looking for adjustments to the validator defaults to have select2 look uniform