I am using Bootstrap with Bootstrap-Select and Jquery Validation. I am facing the following issue:
https://jsfiddle.net/0q5qz3hp/
http://stackoverflow.com/questions/34089048/bootstrap-select-and-jquery-validation-option-check
Any help on this?
First, use the newest version of bootstrap-select (you're using v1.6.5 in your example). Also, for some reason, jQuery Validation uses blur instead of the change event to trigger unhighlight.
This snippet should work:
$('.selectpicker').on('change', function () {
var $el = $(':focus');
$(this).blur();
$el.focus();
});
Edit:
Looking at the documentation, this is probably a better alternative:
$('.selectpicker').on('change', function () {
$(this).valid();
});
Here is simple solution which worked for me:
var validator = $('#myForm').validate({
.
.
.
});
$('select.select-field').on('change', function () {
validator.element($(this));
});
That's it
Thank you @caseyjhol problem fixed.
Most helpful comment
First, use the newest version of bootstrap-select (you're using v1.6.5 in your example). Also, for some reason, jQuery Validation uses
blurinstead of thechangeevent to triggerunhighlight.This snippet should work:
Edit:
Looking at the documentation, this is probably a better alternative: