JQueryValidation - Input error class name

jquery, jquery-validate

Solution

I don't see any real reason to support different class names for the error element and the input field itself.

Just use CSS-selectors

label.field-validation-error {
  ..whatever styling...
}
input.field-validation-error {
  ..whatever styling...
}

This way both have the same css-class applied but get different styling

But if you really think you need this than you can use the `highlight` and `unhighlight` options of the validation plugin and wire them up with functions. These can then apply the wanted styles to the element and the error label. In the documentation is even a nice example of this which you should be easily able to modify to your needs

Problem

Is there a way with the JQueryValidation plugin to set the input css class error. This css class is different from the label css error class. Because if I set : `errorClass: "field-validation-error"` That will apply for label and input. I would like input to have "input-validation-error" css class and label to have "field-validation-error" css class.

Original source