Get started with require-jquery CDN
CC0-1.0 licensed
Solves asynchronous jQuery loading and management in CommonJS, ES modules .
Tags:- loader
- modules
- asynchronous
- popular
- jquery
Stable version
Copied!
How to start using require-jquery CDN
// Define the requirejs configuration
const requireConfig = {
baseUrl: '/',
paths: {
'jquery': 'https://cdn.cdnhub.io/require-jquery/0.25.0/require-jquery.min'
}
};
// Initialize requirejs with the configuration
requirejs.config(requireConfig);
// Define your main module that depends on jQuery
const main = function () {
require(['jquery'], function ($) {
// Use jQuery as usual
$('document').ready(function () {
console.log('Document is ready!');
$('button').click(function () {
console.log('Button clicked!');
});
});
});
};
// Call the main function
main();
Copied!
Copied!