`

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>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics