zoukankan      html  css  js  c++  java
  • jquery.datepicker、jquery.validate、jquery.uploadify冲突解决

    Jquery 1.11.2

    Jquery.validate 1.13.1

    Jquery.Uploadify 3.2(flash版)

    Jquery.DatePicker 用的是Jquery-ui 1.11.2

    项目需要,一个页面上就同时使用了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

  • 相关阅读:
    IReport问题整理
    超出打开游标的最大数的原因和解决方案【131101】
    【131031】rel 属性 -- link标签中的rel属性,定义了文档与链接的关系
    【131031】html:hidden的使用
    <jsp:include>和<%@include file=""%>区别【131031】
    【131031】<meta http-equiv=...> 的功能
    【131031】asp.net <%%>&<%#%>&<%=%>&<%@%>&<%$%>用法区别
    python面向对象(类的成员及类方法)
    python网络编程知识体系
    python面向对象(类和对象及三大特性)
  • 原文地址:https://www.cnblogs.com/lyeo/p/4283136.html
Copyright © 2011-2022 走看看