1<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
1<!-- First either download, or use CDN and reference it -->
2<!-- Here we grab it from a CDN -->
3<script
4 src="https://code.jquery.com/jquery-3.4.1.js"
5 integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
6 crossorigin="anonymous"></script>
7
8<!-- Lets say we have some <p>, with simple text
9 we give it an id -->
10<p id="example">Hello, world</p>
11
12<!-- We shall now play around with this element using jQuery -->
13<script type="text/javascript">
14 // The vanilla way of accessing our example p element is
15 var e = document.getElementById('example');
16 // Then we would faff about with 'e'
17
18 // With jQuery we can get it like...
19 var ej = $('#example');
20
21 // jQuery has its own methods, instead of innerText and
22 // all those similar properties, we can do
23 $('#example').text("Goodbye everybody, I've got to go");
24
25 // Our example p element text will have changed :)
26</script>
1<html>
2 <head>
3 <meta charset="utf-8" />
4 <meta name="viewport" content="width=device-width, initial-scale=1" />
5 <title>jQuery</title>
6 </head>
7 <body>
8 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
9 <script>
10 //jQuery code
11 </script>
12 </body>
13</html>