如果选择单选按钮,jQuery 将验证字段的不同子集
我正在使用 jquery 验证插件来验证表单输入。我遇到的问题是我有一个单选按钮组,它根据所选的单选按钮隐藏和显示不同的字段。
如何验证根据选择的单选按钮选项隐藏和显示的字段子集。
谢谢
I am using the jquery validate plugin to validate form input. The problem I have run into is that I have a radio button group that hides and shows different fields based on the radio button selected.
How can I validate the subset of fields that are hidden and shown depending on what radio button option is selected.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
depends
规则:此示例将
contact
字段设置为仅在选中#myCheckbox
字段时才需要。Use the
depends
rule:This example sets the
contact
field to only be required is the#myCheckbox
field is checked.