This happens when your custom script runs before the jQuery script download completes. Always place the jQuery script tag above your custom application logic files.
The Ultimate Guide to jQuery Script Download: Methods, Best Practices, and Modern Alternatives
Copy and paste one of these highly reliable public CDN links directly into your HTML document: Use code with caution. cdnjs (Cloudflare): Use code with caution. jsDelivr: Use code with caution. 3. The Package Manager Method (Modern Build Tools) jquery script download
Download Compressed Production Version | Download Uncompressed Development Version
Using a CDN is the fastest way to get started. CDNs serve the file from geographically distributed servers, reducing latency and accelerating page load times. This happens when your custom script runs before
If you use build tools like Webpack, Vite, or Rollup, manage your jQuery download via a package manager to track version updates easily. npm install jquery Use code with caution. Using Yarn: yarn add jquery Use code with caution. Import it directly into your JavaScript module: javascript
Downloading the file and hosting it on your own server gives you absolute control over your dependencies. It ensures your scripts work offline during local development. cdnjs (Cloudflare): Use code with caution
If you plan on using $.ajax() , $.get() , or jQuery animations like .animate() , avoid downloading the .slim.js variations. Those modules are completely stripped out of the slim build to save file size.