[英]How to resolve conflict issues with jQuery + other libraries
Can someone help me figure out how to write a no conflict function for js for my weebly website. 有人可以帮我弄清楚如何为我的weebly网站编写js的无冲突函数。
http://cadogan.weebly.com/big-name.html http://cadogan.weebly.com/big-name.html
Thank you. 谢谢。
I assume you mean that you get errors when you try to reference jQuery using $. 我假设您的意思是,尝试使用$引用jQuery时会出错。
Since you are loading Scriptaculous after jQuery, it is overwriting the $ alias to jQuery. 由于您要在jQuery之后加载Scriptaculous,因此它将$别名覆盖到jQuery。 You can instead us the jQuery object directly. 您可以改为直接使用jQuery对象。
jQuery(function() {
jQuery('#mydiv').html("<h1>hi</h1>");
});
You could try using jQuery
instead of $
, or using the .noConflict()
method: 您可以尝试使用jQuery
而不是$
,或使用.noConflict()
方法:
http://api.jquery.com/jQuery.noConflict/ http://api.jquery.com/jQuery.noConflict/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.