sn0ep
sn0ep

Reputation: 3943

jQuery.validate.js Error labels beneath textfields

Im using jquery.validate.js for form validation but i cant seem to fix the fact that the error labels show to the right of the input fields. I want them to appear beanth the input fields.

does anyone know how to get this result?

// edit

Solved it:

i went inside jquery.validate.js

edited the following:

// from line 627
627. showLabel: function(element, message) {
628. message = "<br>"+message;

Upvotes: 0

Views: 1587

Answers (1)

MikeM
MikeM

Reputation: 27405

while it worked to edit the validate script directly that may not be very maintainable down the road or may not be an option for someone viewing this question later.

Here's an alternative,

jQuery validation errors generate something like:

<label for="input1" generated="true" class="error">This field is required</label>

it also adds class "error" to the input element itself <input id="input1" name="input1" type="text" class="requirederror" />

So to style the error and in this case make it show under the input you can do something like...

CSS:

label.error {
    display:block;
}

Upvotes: 1

Related Questions