jQuery验证 - 至少需要一个同名的输入 [英] jQuery Validation - require at least one input of the same name

查看:98
本文介绍了jQuery验证 - 至少需要一个同名的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Jquery Validation 插件,并提供一系列同名输入在一个数组中,例如5个输入,名称=name []

I'm using the Jquery Validation plugin and have a series of inputs with the same name in an array, for example 5 inputs with name="name[]"

我想要至少有一个必需。谁会知道怎么做?谢谢!

I want to have at least one of these required. Would anyone know how to do this? Thanks!

推荐答案

您可以更一般地说明至少必须填充与选择器Y匹配的X输入。 (在你的情况下,X是1,Y是具有特定名称。)

You can state this more generally as "at least X inputs that match selector Y must be filled." (In your case, X is 1 and Y is "with a specific name.")

我在这里解决了一般问题:

I addressed the general problem here:

jQuery Validate - 要求组中至少有一个字段填充

这篇关于jQuery验证 - 至少需要一个同名的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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