關於jquery版本衝突問題

來源:互聯網
上載者:User

標籤:ar   java   sp   檔案   on   問題   bs   時間   as   

今天做項目時,碰到一個問題,糾結了好幾個小時。我需要引入jquery-1.9.1.js來滿足我引入的別的js檔案,但同時,我也需要引入jquery.js,這個是必須要引入的。而這兩個不能只引入一個,同時引入又碰到問題。後來,試了很長時間,終於發現一個辦法可行。

<script type="text/javascript" src="../../js/jquery-1.9.1.js"></script>
 <script type="text/javascript" src="../../js/jquery.collapse.js"></script> 
 <script type="text/javascript">
  var jQuery_1_9_1 = jQuery.noConflict(true);
 </script>

然後,引入jquery.js。

在jsp頁面中,需要用到jquery-1.9.1.js中的函數將$換成jQuery_1_9_1即可。(如:var temp = jQuery_1_9_1("#myid");)

解決!

關於jquery版本衝突問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.