开发者

Do we need to change anything in main jquery library ever to use jquery noconflict?

开发者 https://www.devze.com 2022-12-18 04:57 出处:网络
Do we nee开发者_StackOverflow社区d to change anything in main jquery library ever to use jquery noconflict?You don\'t have to change the jquery lib itself but you have to change your code using jquery

Do we nee开发者_StackOverflow社区d to change anything in main jquery library ever to use jquery noconflict?


You don't have to change the jquery lib itself but you have to change your code using jquery. Instead of $('#myid') you have to use jQuery('#myid') then.

For more information on the noconflict mode visit http://docs.jquery.com/Using_jQuery_with_Other_Libraries


Not in the jquery library itself, but some plugins rely on the $ variable.


Your question is not very clear, is this what you mean?

 jQuery.noConflict();
 jQuery('#id'); //instead of $('#id');

Because then you should change all your code to use jQuery instead of $. If you mean your won extensions, you should set them up as follow:

(function($){
   $.myPlugin = function() { ]
})(jQuery);

Then you are safe for people who use jQuery.noConflict


I'm sure it's a big NO. You don't really have to.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号