We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

bcalloway on 09/24/08


Tagged

form jquery validation


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

sulfurito
classicalart


jQuery Form Validation


Published in: JavaScript 


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

  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 

You need to login to post a comment.