当前位置: 代码迷 >> Web前端 >> jquery 与prototype 矛盾结局方案
  详细解决方案

jquery 与prototype 矛盾结局方案

热度:176   发布时间:2012-10-07 17:28:51.0
jquery 与prototype 冲突结局方案
一种代码示例:
  思想是采用闭包,先将jquery使用的$释放,然后在用闭包引入$这样,两个框架都可以使用$了。

<html>
 <head>
   <script src="/prototype.js"></script>
   <script src="/jquery.js"></script>
   <script>
   jQuery.noConflict();

     // Put all your code in your document ready area
     jQuery(document).ready(function($){
       // Do jQuery stuff using $
       $("div").hide();
     });
// Use Prototype with $(…), etc. $('someid').hide(); </script> </head> <body></body> </html>
  相关解决方案