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);
},
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);
},
Share
Improve this question
asked Jun 7, 2011 at 14:29
CofeyCofey
11.4k16 gold badges54 silver badges75 bronze badges
2
-
1
$(element).next().after(error);
? – Sparkup 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! – Cofey Commented Jun 7, 2011 at 14:39
1 Answer
Reset to default 6This may help
$(element).next().after(error);
Demo : http://jsfiddle/sparkup/behLgebw/