Skip to content

Instantly share code, notes, and snippets.

@eperedo
Created August 24, 2012 02:12
Show Gist options
  • Save eperedo/3444740 to your computer and use it in GitHub Desktop.
Save eperedo/3444740 to your computer and use it in GitHub Desktop.
jQuery Validation 1.9 for twitter bootstrap 2.1
jQuery.validator.setDefaults({
validClass: "success",
errorElement: "span",
errorPlacement: function(error, element){
$(error).addClass('help-block').insertAfter(element);
},
highlight: function(element, errorClass, validClass) {
$(element).parents('div.control-group').addClass(errorClass).removeClass(validClass);
},
unhighlight: function(element, errorClass, validClass) {
$(element).parents('div.control-group').removeClass(errorClass).addClass(validClass);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment