标签:
项目需要,一个页面上就同时使用了jquery.datepicker、jquery.validate、jquery.uploadify,结果使用中就发现uploadify和datepicker和validate各种冲突,报错都是js缺少对象。查了好久终于找到了解决原因
jquery文件要修改此处,增加了红字部分
/**
* Determines whether an object can have data
*/
jQuery.acceptData = function (elem) {
var noData = jQuery.noData[(elem.nodeName + " ").toLowerCase()],
nodeType = +elem.nodeType || 1;
// Do not set data on non-element DOM nodes because it will not be cleared (#8335).
return nodeType !== 1 && nodeType !== 9 ?
false :
// Nodes accept data unless otherwise specified; rejection can be conditional
!noData || noData !== true && elem.getAttribute != null && elem.getAttribute("classid") === noData;
};
jquery.validate要将下面的代码注释掉:
$( this.currentForm ) .validateDelegate( ":text, [type=‘password‘], [type=‘file‘], select, textarea, " + "[type=‘number‘], [type=‘search‘] ,[type=‘tel‘], [type=‘url‘], " + "[type=‘email‘], [type=‘datetime‘], [type=‘date‘], [type=‘month‘], " + "[type=‘week‘], [type=‘time‘], [type=‘datetime-local‘], " + "[type=‘range‘], [type=‘color‘], [type=‘radio‘], [type=‘checkbox‘]", "focusin focusout keyup", delegate) // Support: Chrome, oldIE // "select" is provided as event.target when clicking a option .validateDelegate("select, option, [type=‘radio‘], [type=‘checkbox‘]", "click", delegate);
就解决了。
至于去掉后到底有多少影响,还在测试,不过目前项目运行了2个多月没有发现有什么问题,至于什么原理也没搞清楚,查了好多资料也没找到问题所在,只说uploadify很蛋疼~
参考链接 http://blog.csdn.net/dyllove98/article/details/42871203
jquery.datepicker、jquery.validate、jquery.uploadify冲突解决
标签:
原文地址:http://www.cnblogs.com/lyeo/p/4283136.html