How to install jQuery?
Different ways to install jQuery
There are several ways to install & use jQuery on your web site.
- Using jQuery with a CDN
- Download the jQuery library from jQuery.com
- Download jQuery using npm or Yarn
- Download jQuery using Bower
1. Using jQuery with a CDN
CDNs can host jQuery on servers across the globe.
jQuery hosted CDN : https://code.jquery.com/
Adding CDN code for minified jQuery lib.you can copy and past it into the head section on your HTML page.
<script src=”https://code.jquery.com/jquery-3.4.1.min.js” integrity=”sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=” crossorigin=”anonymous”></script>
Check out the demo on GitHub.
Other CDN links :
2. Download the jQuery library from jQuery.com
Two types of versions available for jQuery download.
- Production version: used with live website/apps as its compressed and minified. Github
- Development version: used for local server development as its uncompressed. Github
Go to the https://jquery.com/download/ and download the required version form the list.
3. Download the jQuery library from jQuery.com
npm install jquery
As an alternative you can use the Yarn CLI command:
yarn add jquery
This will install jQuery in the
node_modules directory. Within
node_modules/jquery/dist/ you will find an uncompressed release, a compressed release, and a map file.
4. Download jQuery using Bower
jQuery is also registered as a package with Bower. You can install the latest version of jQuery with the command:
bower install jquery
This will install jQuery to Bower’s install directory, the default being
bower_components/jquery/dist/ you will find an uncompressed release, a compressed release, and a map file.
if you wish to install just the compressed jQuery file, you can install just that file with the following command:
bower install https://code.jquery.com/jquery-3.4.1.min.js
Find out browser support for the jQuery: https://jquery.com/browser-support/
This is it. Happy Coding.