<p>I'm looking for a plugin for jQuery that can validate as a key is pressed and after it loses focus (text boxes). </p>

<p>I'm currently using <a href="http://www.overset.com/2008/07/31/jval-jquery-form-field-validation-plugin/" rel="nofollow noreferrer">jVal - jQuery Form Field Validation Plugin</a>. It works pretty good.  The only issue I have is that I can only use a generic error message.</p>

<p>For example:
  I need a string to between 2 and 5 characters.  If its too short I would like to display an error message that indicates it to short, equally if its too long. I know I could display an error message that requires the string to between 2 and 5 characters.  <strong>The validation that is being done is more complicated.</strong> </p>

<p>Any ideas of other validators or how I could use this plug-in to display unique error messages.</p>

<hr>

<p>Edit:</p>

<p>The validation tool needs to prevent particular letters or numbers and not require a form.  </p>

<p>Thanks</p>

This one looks like it would fit your description:
jQuery plugin:validation (Homepage)
demo
API docs
Here's a snippet of code copied from the source of the demo:
```
```
// validate signup form on keyup and submit
$("#signupForm").validate({
    rules: {
        firstname: "required",
        lastname: "required",
        username: {
            required: true,
            minlength: 2
        },
        password: {
            required: true,
            minlength: 5
        },
        confirm_password: {
            required: true,
            minlength: 5,
            equalTo: "#password"
        },
        email: {
            required: true,
            email: true
        },
        topic: {
            required: "#newsletter:checked",
            minlength: 2
        },
        agree: "required"
    },
    messages: {
        firstname: "Please enter your firstname",
        lastname: "Please enter your lastname",
        username: {
            required: "Please enter a username",
            minlength: "Your username must consist of at least 2 characters"
        },
        password: {
            required: "Please provide a password",
            minlength: "Your password must be at least 5 characters long"
        },
        confirm_password: {
            required: "Please provide a password",
            minlength: "Your password must be at least 5 characters long",
            equalTo: "Please enter the same password as above"
        },
        email: "Please enter a valid email address",
        agree: "Please accept our policy"
    }
});
```
```