Jquery 验证 任意一个字段为必填项

发布于 2024-08-23 16:13:35 字数 152 浏览 1 评论 0原文

使用 Jquery 验证插件,我很好奇是否有某种内置的具有“两者之一”的功能是强制性检查。例如:电子邮件或手机号码是必填项吗?

Using the Jquery validation plugin, I was curious to know if there is some sort of in-built functionality to have a "one of the two" is mandatory check. e.g: Email or mobile number is mandatory?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鸩远一方 2024-08-30 16:13:35

好吧,我谷歌搜索得不够,这是对的。

要回答这个问题,默认情况下“否”显然不是,但编写自定义规则也不是太难。

Rebecca 在她的博客上发布了一个解决方案,网址为 http://blog.rebeccamurphey.com/2009/04/15/jquery-validation-indicate-that-at-least-one-element-in-a-需要组/

Ok serves me right for not googling enough.

To answer the question, by default No apparently it's not, but it isn't too difficult to write a custom rule either.

Rebecca has posted a solution on her blog at http://blog.rebeccamurphey.com/2009/04/15/jquery-validation-indicate-that-at-least-one-element-in-a-group-is-required/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文