jQuery的validate 在ie9和火狐下能用 在ie8下无效解决方法。
此文章出自csdn博客
http://blog.csdn.net/tadpole1027/article/details/6822839
这个问题 折腾我一天了。 网上也找不到答案,基本都是问题已经解决就无下文了,也没有分享问题解决方法 。
后来查到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;
});
问题暂时解决。不知道还是否留下其他问题或者引起其他错误。
- jQuery的validate 在ie9和火狐下能用 在ie8下无效解决方法。
- JQuery.validate在ie8浏览器下不验证直接提交解决方法
- JQuery.validate在ie8下不支持的快速解决方法
- jQuery validate插件,自动验证无效的原因及解决方法归纳
- JQuery.validate在ie8下不支持的快速解决方法
- eWebEditor不支持IE9,IE8,IE7,火狐,遨游的解决方法
- jquery validate在ie8下的bug解决方法
- jquery validate在ie8下的bug解决方法
- eWebeditor在IE8、IE9中插入图片按钮不能使用问题的解决方法
- js原生态函数中使用jQuery中的 $(this)无效的解决方法
- 火狐FF和IE兼容下margin-top无效的解决方法
- 让IE6 IE7 4000 IE8 IE9 IE10 IE11支持Bootstrap的解决方法
- 前端使用Jquery的getJSON方法,后台使用PHP,解决IE和火狐Firefox中存在的跨域ajax请求问题。
- jquery.validate.js:1110 Uncaught ReferenceError: jQuery is not defined at jq 异常解决方法
- jQuery 淡入淡出 png图在ie8下有黑色边框的解决方法
- jQuery 更改checkbox的状态,无效的解决方法
- jQuery Validate验证框架 + CKEditor 无法验证问题的解决方法
- 解决火狐中用JQUERY .removeAttr()无法去除元素属性的方法
- 解决jQuery uploadify3.2 IE6 IE7 或者 firefox下不显示,chrome IE8 IE9却正常
- 让IE6 IE7 IE8 IE9 IE10 IE11支持Bootstrap的解决方法