简体   繁体   English

RateIt jquery插件与我在项目中的jquery文件产生冲突?

[英]RateIt jquery plugin creating a conflict with the jquery file that i have in my project?

I have got two jquery files in my project both of them works separately but when i keep them together they doesn't work. 我的项目中有两个jquery文件,它们都可以单独工作,但是当我将它们放在一起时,它们将无法工作。 Rate it plugin works separately but when i combine with my project it doesn't works so how can we make the both work together. 评价它的插件是单独工作的,但是当我与我的项目结合使用时,它是行不通的,因此我们如何才能使两者一起工作。

Use $.noConflict() to avoid conflicts between jquery's files : 使用$ .noConflict()避免jquery的文件之间发生冲突:

Follow this link : 点击此链接:

http://api.jquery.com/jquery.noconflict/

You can also use jQuery instead of $ . 您也可以使用jQuery代替$ Like if jQuery and the other plugin uses same structure like $() then its better to use jQuery or jq instead of $ . 就像jQuery和其他插件使用$()这样的结构一样,最好使用jQueryjq而不是$

For example: 例如:

$(document).ready(function(){
  $("button").click(function(){
    $("p").text("jQuery is still working!");
  });
});  

Can also be written like: 也可以这样写:

$.noConflict();
jQuery(document).ready(function(){
  jQuery("button").click(function(){
    jQuery("p").text("jQuery is still working!");
  });
}); 

You can check followings links for more info: link1 and link2 . 您可以检查以下链接以获取更多信息: link1link2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM