jQuery Get Started


Adding jQuery to Your Web Pages

There are several ways to start using jQuery on your web site.

You can:

  • Download the jQuery library from jQuery.com
  • Include jQuery from a CDN, like Google

Downloading jQuery

There are two versions of jQuery available for downloading:

  • Production version - this is for your live website because it has been minified and compressed
  • Development version - this is for testing and development (uncompressed and readable code)

Both versions can be downloaded from jQuery.com.

The jQuery library is a single JavaScript file, and you refer to it with the HTML <script> tag (note that the <script> tag must be within the <head> section):


<head>
<script src="jquery-3.5.1.min.js"></script>
</head>

Tip: Place the downloaded file in the directory as the pages you wish to use.


jQuery CDN

If you do not want to download and own jQuery yourself, you can download it from CDN (Content Delivery Network).

Google is an example of someone who owns jQuery:


Google CDN:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>

One major benefit of using jQuery hosted from Google:

Many users have already downloaded jQuery from Google when they visit another site. As a result, it will be loaded from the repository when they visit your site, resulting in faster loading time. Also, many CDNs will ensure that when a user requests a file from it, it will be delivered from the server closest to them, resulting in faster downloads.