RequireJS – jQuery


RequireJS – jQuery


”;


RequireJS uses jQuery as another dependency and registers as named module jquery in lowercase and by default, also registers itself by using the global functions $ and jQuery while using the AMD/RequireJS.

Loading jQuery

require([''jquery''], function($) {
   //code here
}

You can load multiple and custom libraries along with the jQuery as shown below −

require([''custom_library_path'',''jquery''], function(load_library,$) {
   //related code of $ and load_library
});  

The following table shows the use of jQuery with RequireJS for specifying their dependencies.

Sr.No. Types & Description
1 Using Shim Config

jQuery uses shim configuration to define the dependencies for jQuery plugins.

2 Loading jQuery from CDN

jQuery uses CDN to define the dependencies for jQuery plugins.

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *