add jquery to javascript code example
Example 1: how to start using jQuery CDN
<script
src="https://code.jquery.com/jquery-3.4.1.js"
integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin="anonymous"
></script>
Example 2: html how to add jquery
<!--You can insert Jquery into HTML with the <script> tag in the <head>-->
<!--Insert the next line of code into your <head> tags.-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <!-- jquery (help with javascript) -->
Example 3: add jquery in js
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = "http://code.jquery.com/jquery-2.2.1.min.js";
script.onreadystatechange = handler;
script.onload = handler;
head.appendChild(script);
function handler(){
console.log('jquery added :)');
}
Example 4: add jquery script in html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>