转自:http://blog.sina.com.cn/s/blog_608475eb0100h3h1.html

官网地址:http://bassistance.de/jquery-plugins/jquery-plugin-validation

修改版文件下载:Validate

解决重复Name只验证第一个控件的问题:

1、解决验证问题:

将elements节中的

// 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 this element if this has the same name as one in cache (may be was dynamically added)
                if (this.name in rulesCache) {
                    if (!validator.objectLength($(this).rules())) {
                        $(this).rules('add', rulesCache[this.name]);
                    }
                    return true;
                }

                if (!validator.objectLength($(this).rules())) {
                    return false;
                }
View Code

相关文章:

  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
猜你喜欢
  • 2022-01-04
  • 2021-11-07
  • 2021-10-01
  • 2021-09-12
  • 2022-01-06
相关资源
相似解决方案