validate的使用
插件验证是通过控件的name属性进行判断的
jquery.validate.js 相同name的多个元素只能验证第一个元素的解决办法
动态生成的相同name的元素验证只会取第一个.
很恼火的问题.只有将jquery.validate.js中的对相同name的元素判断注释掉.
但是不知道会不会引起其他地方的BUG
希望以后jquery.validate.js能做针对元素ID进行验证而不仅仅针对元素name验证.
方法:
将484行的代码注释掉即可
Java代码
// select only the first element for each name, and only those with rules specified
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
return false;
}
// select only the first element for each name, and only those with rules specified
if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
return false;
}
注释成
Java代码
// select only the first element for each name, and only those with rules specified
/*if ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {
return false;
}*/