How do you style the errored input fields with the jQuery validation plugin?
I'm using the jQuery validation plugin, an开发者_StackOverflowd I want to add a class to the input fields that doesn't validate, i.e. add a red border.
Anyone know how to do this?
jQuery Validation
The validation plugin adds the class 'error' to the input with the validation error.
Therefore you can style it independently.
For example:
.error {
border: 1px solid red;
}
This form has the effect you want and uses the same plug-in, perhaps you could peek under the covers to see how they did it:
http://jquery.bassistance.de/validate/demo/marketo/
EDIT: I started peeking for you, but then Jon posted the answer.
精彩评论