jQuery 验证插件不验证未显示的字段
我发现了这个问题,但它是在2009年写的,大概是从那时起他们已决定默认忽略隐藏字段...有人知道我如何验证我的隐藏字段吗?
我有一个自定义的 invalidHandler 来处理结果,并看到一些奇怪的行为,我现在意识到这是因为我的一些字段被隐藏(使用 display:none)。我有一个选项卡式表单,因此隐藏了一些元素仅供参考。
提前致谢。
I have found this question but it was written in 2009, presumably since then they have decided to ignore hidden fields by default...anyone know how I can validate my hidden fields?
I have a custom invalidHandler to deal with the result and was seeing some strange behaviour, I now realise this is because some of my fields are hidden (using display:none). I have a tabbed form, hence some elements being hidden FYI.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了答案...
我开始查看验证器插件代码并发现了这一点:
所以我将选项“忽略”设置为空字符串并且它有效。我想应该更新文档,因为它没有说明有默认的忽略。
不管怎样,谢谢。
Found the answer...
I started looking at the validator plugin code and came across this:
So I set the option 'ignore' to an empty string and it works. I guess the documentation should be updated because it doesn't state that there is a default for ignore.
Thanks anyway.