Cofey
Cofey

Reputation: 11404

How to place jQuery Validate error message after the label?

I am using jQuery Validate and need to place the error message AFTER the label element. Currently, it's just inserting it after the input and before the element.

Can someone tell me how do this?

<td>
    <input type="text" id="name" name="name" class="text">
    <label for="name">Name</label>
</td>

errorElement: "div",
errorPlacement: function(error, element) {
    $(element).after(error);
},

Upvotes: 2

Views: 5473

Answers (1)

Sparkup
Sparkup

Reputation: 3754

This may help

$(element).next().after(error);

Demo : http://jsfiddle.net/sparkup/behLgebw/

Upvotes: 6

Related Questions