简体   繁体   中英

Editing a jQuery plugin for matching different jQuery version

I have assigned jQuery.noConflict() to $jq :

var $jq = jQuery.noConflict();

Now I want to edit a jquery plugin to use $jq. There are a lot of codes in the following style:

(function($) { /* some code that uses $ */ })(jQuery)

Changing $ to $jq doesn't solve the problem. What should I do?

You don't need to do anything. The $ is a variable local to the function that wraps the plugin; it's immediately assigned to jQuery , as you can see after the function literal:

})(jQuery) // Immediately calls the wrapper function with jQuery being passed
           // as the $ argument.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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