jquery 验证 - 尝试验证单选按钮和复选框按钮并使用 ErrorPlacemant 在每个组下方显示错误
新手来了 我正在尝试让单选按钮和复选框按钮进行验证。
错误消息应出现在最后一个单选/复选框组下
单选按钮需要选择 检查按钮需要至少选择一个
--- 在媒体上,因为所有按钮都有一个唯一的 ID,所以我将其视为一个组,但迷失了 addMethod 来验证组。
--- 另外在 errorPlacement 上,如果我没有元素 ID,我该怎么办?
基本上没问题,但现在我得到了错误的 InValids 数量我的警报
Newbie here
I am trying to get Radio buttons and checkbox buttons to validate.
Error message should appear under the last it's groups of radio/checkbox
The radio buttons requires a selection
The check buttons Required one selected minimum
--- On the Media, since all have a unique ID I treated it as a group, but am lost on
addMethod to validate group.
--- Also on errorPlacement what do I do if I don't have an Element ID?
Mostly OK, but now I get wrong number of InValids in my alert
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实上,我们前几天就遇到了这个问题,这就是我解决它的方法:
其中
.rbl
是一个标记,看起来像这样,带有以下 css :
css:
同样的情况也适用于带有
.cbl
的复选框列表。所有其他非单选和复选框类型将使用标准错误放置。希望有帮助。
We had this come up just the other day actually, this is how I resolved it:
Where
.rbl
is a<table>
tag and looks like this with the following css:css:
The same can be applied for checkbox lists with a
.cbl
. All other non-radio and checkbox types will use standard error placement.Hope that helps.