Skip to content

Instantly share code, notes, and snippets.

@sojourning
Created July 3, 2014 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sojourning/0022aeb964ec527d7662 to your computer and use it in GitHub Desktop.
Save sojourning/0022aeb964ec527d7662 to your computer and use it in GitHub Desktop.
var validator = jQuery("#myformid").validate({
onfocusout: false,
onkeyup: true,
onclick: true,
focusInvalid: true,
rules: {
//replace with your fields
field-id: "required"
},
messages: {
//replace with your error message
field-id: "This field is required"
},
errorPlacement: function(error,element){
error.insertAfter(element);
alert(error.html());
},
showErrors: function(errorMap, errorList){
this.defaultShowErrors();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment