To start working with jQuery, you need to include a jQuery JS file on your web page. There are two ways to use a jQuery file on your web page; either you can download it from the official jQuery website or link directly using CDN services.

How to Use jQuery

jQuery Download File

  • Compressed and uncompressed copies of jQuery files are available to download; you can download the production compressed version; if you don't want to edit it later.
  • To use jQuery by using the downloaded file, you need to add the jQuery js file to your webpage by using HTML <script> tag.
Example:
<script src="jquery.min.js"></script>

jQuery CDN

jQuery is already hosted on CDN, so you can use it directly without downloading, and it is also the best solution to save server bandwidth by using CDN services.

Example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>