javascript - How to place jQuery Validate error message after the label? - Stack Overflow

I am using jQuery Validate and need to place the error message AFTER the label element. Currently, it&#

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
Add a ment  | 

1 Answer 1

Reset to default 6

This may help

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

Demo : http://jsfiddle/sparkup/behLgebw/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744786985a4593686.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信