读书人

jquery 与prototype 矛盾结局方案

发布时间: 2012-10-07 17:28:51 作者: rapoo

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>

读书人网 >Web前端

热点推荐