jQuery Form Validation


/ Published in: JavaScript
Save to your folder(s)

this requires jquery.js, jquery.metadata.js, and jquery.validate,js


Copy this code and paste it in your HTML
  1. //contact-form validation
  2. $("form#contact-form").validate({
  3. errorPlacement: function(error, element) {
  4. //appends error message to the p tag of the form field
  5. error.appendTo( element.parent("p") );
  6. }
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.