jQuery验证错误Placement麻烦 [英] jquery validation errorPlacement trouble

查看:78
本文介绍了jQuery验证错误Placement麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jquery.com的验证插件部分中的errorPlacement示例给出了以下示例:

The example of errorPlacement in the validation plugin section of jquery.com gives this example:

error.appendTo(element.parent("td").next("td"));

error.appendTo( element.parent("td").next("td") );

在输入后将错误添加到"td".我正在尝试做类似的事情,但我没有使用"td"元素.

Which adds the error to the "td" after the input. I am trying to do a similar thing but I am not using "td" elements.

这是我的HTML外观:

This is what my HTML looks like:

<p><label>Employee Number:</label><input type="text" name="eenum" id="eenum" class="required" /><span></span></p>

我正在尝试使错误出现在输入后的"span"中,但是我一直没有尝试的任何方法都能正常工作.如果根本没有出现该错误,则该错误始终在输入之前.

I am trying to get the error to appear in the "span" after the input, but nothing I have been trying works correctly. If the error appears at all, it is always preceding the input.

推荐答案

那么,您尝试了什么?应该是

So, what did you try? It should be

error.appendTo(element.next("span"));

这篇关于jQuery验证错误Placement麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆