首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

解决 jQuery Validation插件 雷同名称文本框只验证第一个

2012-10-13 
解决 jQuery Validation插件 相同名称文本框只验证第一个关于jQuery Validation插件,当页面有相同名称文本

解决 jQuery Validation插件 相同名称文本框只验证第一个

关于jQuery Validation插件,当页面有相同名称文本框只验证第一个的解决办法.?

打开源文件,找到elements方法.

注释掉:

elements: function() {var validator = this,rulesCache = {};// select all valid inputs inside the form (no submit or reset buttons)// workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solvedreturn $([]).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 specifiedif ( this.name in rulesCache || !validator.objectLength($(this).rules()) )return false;rulesCache[this.name] = true;return true;});},
1 楼 lqixv 2011-08-26   能不能发一个修改好的版本出来?谢谢 2 楼 lqixv 2011-08-26   我动态增加多个输入框后,按照你的方法,确实可以进行同名验证了。现在的问题是,错误总是出现在第一个出现错误的地方。这个怎么解决? 3 楼 txlaijava 2011-08-31   lqixv 写道我动态增加多个输入框后,按照你的方法,确实可以进行同名验证了。现在的问题是,错误总是出现在第一个出现错误的地方。这个怎么解决?
这个问题我也还没有解决. 但是我想到一个办法. 把错误提示放到相同名字文本框的顶部.

热点排行