Created
March 18, 2014 17:43
-
-
Save bradrice/9625254 to your computer and use it in GitHub Desktop.
jquery validator overides for bootstrap 3`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// override jquery validate plugin defaults | |
$.validator.setDefaults({ | |
highlight: function(element) { | |
$(element).closest('.form-group').addClass('has-error'); | |
}, | |
unhighlight: function(element) { | |
$(element).closest('.form-group').removeClass('has-error'); | |
}, | |
errorElement: 'span', | |
errorClass: 'help-block', | |
errorPlacement: function(error, element) { | |
if(element.parent('.input-group').length) { | |
error.insertAfter(element.parent()); | |
} else { | |
error.insertAfter(element); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment