jquery.datepicker、jquery.validate、jquery.uploadify衝突解決

來源:互聯網
上載者:User

標籤:

項目需要,一個頁面上就同時使用了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衝突解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.