The most obvious cause of this error is that you forgot to include jQuery before you used it, but there are also more subtle causes that you’ll not see until you deploy your site to production.
1. Your CDN-hosted jQuery might be blocked
If you are using a CDN-hosted version of jQuery such as Google’s Hosted Libraries, these CDNs might be blocked by a filter or proxy service on your customers’ connection. We typically see this issue with requests originating from Chinese or Indonesian IP addresses.
2. Your CDN-hosted jQuery is down or timing out.
Another common example of this bug is when the CDN hosting your jQuery script is unreliable or slow to load. Browsers typically have a timeout of around 20-30 seconds for each script tag.
Reference:
https://www.bugsnag.com/blog/jquery-is-not-defined-cause-solution