I know that you can specify the class name to use for errors, but is it possible to specify a second class name if the error happens on a specific element?
I have a form with inputs and the errors are all aligned to be directly under the input (like so:)

but I have a checkbox further on the page and the current errorClass ends up looking like this:

I want to create a different style for that checkbox so it will align properly.
AFAIK, there is no way to have the plugin apply more than one “error” class, other than using its various built-in callback functions (
highlight,unhighlight, etc.) to apply/remove additional classes. This can quickly get messy and verbose.But there’s really no need to complicate how the plugin spits out the default
.errorclass, when you have CSS.Just specifically target the error message (
label) for the checkbox (with the.errorclass) using CSS…Working Demo: http://jsfiddle.net/gfLR9/
CSS:
HTML:
Clarification: The above target
label[for='myfieldname'].errorwill not interfere with any other additionallabelelements you may have for this same input. Because it’s very specifically targeting only thoselabelelements also withclass="error". See: http://jsfiddle.net/PcxKS/