Use jQuery to validate form text

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

Found on the jquery mailing list:
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.value;
  4. $.post("/path/to/your/validation.php", query, function(response) {
  5. // do something like changing a css class, disable submit...
  6. )};
  7. });


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.