In many real-world projects, developers prefer to download jQuery instead of using CDN.
Downloading jQuery allows the website to work even without an internet connection.
jQuery can be downloaded from the official jQuery website.
After downloading, the jQuery file is added to the project folder and linked manually.
jquery-3.7.1.min.js
The min.js file is a compressed version of jQuery.
Minified files load faster and are recommended for production websites.
my-project
│
├── index.html
└── js
└── jquery-3.7.1.min.js
This is the recommended folder structure used in professional web projects.
JavaScript libraries are usually stored inside a separate js folder.
This script tag links the downloaded jQuery file with your HTML page.
Once this is added, jQuery is available for use in your project.
Important Notes:
- Always use min.js file for live websites
- Keep library files inside js folder
- Do not rename jQuery file randomly
- Load jQuery before your custom script