第一种:先加载prototype,后加载jquery
// Use Prototype with $(…), etc. $('someid').hide(); </script> </head> <body></body> </html> ———————————— 如上所示,红色部分就是对jquery做的一个兼容处理,这样就可以达到 jquery和prototype兼容了。jQuery.noConflict();要放在 最前面, 而jquery的代码就要放到 jQuery(document).ready(function( $ ){ ……… }); 内部。
第二种:先加载jquery,后加载prototype
如上所示,不用调用 jQuery.noConflict();,使用 jQuery(document).ready(function (){ …….. });,在这个函数内部使用 jQuery代替$。