原文来自:http://docs.jquery.com/Using_jQuery_with_Other_Libraries
我对重要的部分做下翻译,希望对大家有所帮助。特别是magneto的js库使用prototype,很多人想用jquery,那么这个兼容就很有用了。
jquery prototype 兼容分两种情况,我们就让prototype可以正常使用,在使用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(); });