Learnmonkey Learnmonkey Logo
× Warning:

The tutorial you are reading is currently a work in-progress.

Setting Up jQuery

How to Setup jQuery

jQuery is hosted on online CDNs. For this tutorial, we will include the jQuery library using the Cloudflare CDN. To do this, simply add


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    

to your head tag. So, your head might look like this:


<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="script.js"></script>
</head>
    
In HTML, the order of your scripts MATTER!!! So, you MUST place the jQuery script before your script.js script or your code WON'T work!!!

Now, you are ready to write your jQuery code!

Writing JavaScript jQuery Code

In order to use jQuery in your JavaScript code, you need to write your JavaScript code in script.js file.