HTML
JS
$.validator.setDefaults({ errorElement: "span", errorClass: "help-block", // validClass: 'stay', highlight: function (element, errorClass, validClass) { $(element).addClass(errorClass); //.removeClass(errorClass); $(element).closest('.form-group').removeClass('has-success').addClass('has-error'); }, unhighlight: function (element, errorClass, validClass) { $(element).removeClass(errorClass); //.addClass(validClass); $(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 if (element.hasClass('select2')) { error.insertAfter(element.next('span')); } else { error.insertAfter(element); } }});$(document).ready(function () { $('.select2').on('change', function () { $(this).valid(); }); $("#gyr_ind").select2(); var validator = $("#documentAdmin").validate();});
css
.has-error .select2-selection { border: 1px solid #a94442; border-radius: 4px;}
http://stackoverflow.com/questions/30783019/styling-jquery-validation-with-select2-4-0-and-bootstrap-3