2

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);
},
2
  • 1
    $(element).next().after(error); ? Commented Jun 7, 2011 at 14:33
  • @Stack 101: That worked. Please add it as an answer and I'll mark it as accepted. Thanks! Commented Jun 7, 2011 at 14:39

1 Answer 1

6

This may help

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

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.