juqery.validate.js中发现elements方法中$([]).add(this.currentForm.elements)方法在ie8下有问题,只能得到一个jquery对象。(ie9和火狐浏览器正常)
后来根据源码中的注释提示在网站 http://bugs.jquery.com/ticket/2114
得到答案 :
原文:
I had an issue where jquery.validate was failing in IE6, caused by
the above error. I fixed this by updating line 446 and changed:
$([]).add(this.currentForm.elements).filter(":input")
to
$(':input',this.currentForm)
于是把juqery.validate.js中elements方法
return $([]).add(this.currentForm.elements)
.filter(":input")
.not(":submit, :reset, :image, [disabled]")
.not( this.settings.ignore )
.filter(function() {
!this.name && validator.settings.debug &&
window.console && console.error( "%o has no name assigned",
this);
// 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;
rulesCache[this.name] = true;
return true;
});
修改为:
return $(':input',this.currentForm)
.not(":submit, :reset, :image, [disabled]")
.not( this.settings.ignore )
.filter(function() {
!this.name && validator.settings.debug &&
window.console && console.error( "%o has no name assigned",
this);
// 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;
rulesCache[this.name] = true;
return true;
});
分享到:
相关推荐
formValidator对主流浏览器有良好的兼容性,包括Chrome、Firefox、Safari、Edge和IE8+。但在某些老版本或非标准浏览器中,可能需要额外的优化工作。 总结,jQuery formValidator插件通过提供便捷的API和丰富的验证...
7. **兼容性**:与大多数现代浏览器兼容,包括Chrome、Firefox、Safari、Edge和IE9及以上版本。 **二、使用步骤** 1. **引入依赖**:首先需要在HTML文件中引入jQuery库和FormValidator的JavaScript及CSS文件。 2. ...
4. **兼容性**:与大多数现代浏览器兼容,包括Chrome、Firefox、Safari、Edge和IE9及以上版本。 5. **文档支持**:附带的使用说明文档,详细解释了如何配置和使用组件,方便开发者上手。 ### 四、使用步骤 1. **...
这个版本的jQuery适用于大部分现代浏览器,包括IE6及以上版本,以及Firefox、Chrome、Safari和Opera等。 "crlCheckCommons.js"可能是开发者自定义的一个验证插件,其中可能包含了各种常用的验证规则和方法。例如,...
- **广泛的兼容性**:jQuery能够兼容各种主流浏览器(包括IE、Firefox、Chrome、Safari等),确保代码在不同环境中都能稳定运行。 #### 二、Ajax框架与jQuery的关系 Ajax(Asynchronous JavaScript and XML)是一...
这个插件兼容多种浏览器,包括IE6到IE8,以及Chrome、Firefox、Safari和Opera 10。尽管在较旧版本的IE中可能无法呈现CSS3的阴影和圆角效果,但基本功能仍然可用。 以下是一些常见的验证规则及其用法: 1. `...