How to use 'jq cdn' in JavaScript

Every line of 'jq cdn' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
17function loadjQuery(url, callback) {
18 var script_tag = document.createElement('script');
19 script_tag.setAttribute("src", url)
20 script_tag.onload = callback; // Run callback once jQuery has loaded
21 script_tag.onreadystatechange = function () { // Same thing but for IE... bad for IE 10, it supports all
22 if (this.readyState == 'complete' || this.readyState == 'loaded') {callback();}
23 }
24 script_tag.onerror = function() {
25 loadjQuery("http://code.jquery.com/jquery-1.8.2.min.js", main);
26 }
27 document.getElementsByTagName("head")[0].appendChild(script_tag);
28}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

42function __carrotware_SetJQueryURL(jqPath) {
43 jqURL = jqPath;
44
45 __carrotware_LoadJQuery();
46}

Related snippets