Use jQuery to validate form text


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

Found on the jquery mailing list: http://jquery.com/discuss/2006-April/004625/
The url shows it in action, checking text when you move away from a field.


Copy this code and paste it in your HTML
  1. $("#my-form input[@type='text']").blur(function() {
  2. var query = {};
  3. query[this.name] = this.value;
  4. $.post("/path/to/your/validation.php", query, function(response) {
  5. // do something like changing a css class, disable submit...
  6. )};
  7. });

URL: http://beta.plazes.com/register/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.