Import Jquery in JS-Code Examples

Radu TM

Import jquery into js file

JavaScript by Radu TM May 20, 2022

//This code adds the jQuery script to the head of the HTML document.
const script = document.createElement('script');
script.src = 'https://code.jquery.com/jquery-3.4.1.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);

0

12.734

How to import jquery in js file

JavaScript by Radu TM May 20, 2022

var script = document.createElement('script');

//set the script element's 'src' attribute to the jQuery library file
script.src = 'https://code.jquery.com/jquery-3.4.1.min.js';

//set the script element's 'type' attribute
script.type = 'text/javascript';

//add the script element to the HTML head
document.getElementsByTagName('head')[0].appendChild(script);

0

11.900

Related JavaScript Queries

Latest JavaScript Queries

Explore code examples by categories