# Console: Uncaught ReferenceError: $ is not defined (jQuery not loaded or loaded after your code)

**Code:** `$ is not defined` · **Category:** Browser · **Seen on:** Chrome, Firefox, JavaScript, WordPress

Your code uses jQuery's `$` before jQuery has loaded — the script is missing, blocked, in the wrong order, or loaded `async`/`defer` after your code.

## Meaning

Scripts run in order. If your inline code or `app.js` comes before the jQuery `<script>`, or the jQuery file fails to load (404, blocked CDN, CSP, offline), `$` and `jQuery` are undefined. Check the Network tab to see whether jQuery loaded at all.

## Common causes

- jQuery `<script>` placed after the code that uses it
- jQuery file 404, blocked by CSP/adblocker, or the CDN is down
- `async` or `defer` changing execution order
- A plugin loaded before jQuery
- Two incompatible jQuery versions (`noConflict`)

## Quick fix

1. Load jQuery first, then plugins, then your code
2. Check the Network and Console tabs for a failed jQuery request
3. Wrap code in `$(document).ready` only after jQuery is present

## Detailed fix by platform

### JavaScript

1. `<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>` then `<script src="app.js"></script>` (or use `defer` on both so order is kept)
2. Debug: `console.log(typeof jQuery)`

### WordPress

1. Use `wp_enqueue_script('my-js', ..., array('jquery'))` and write `jQuery(function($){ ... })` — WordPress runs jQuery in noConflict mode

## How to diagnose

1. **Order** — Which script comes first?
2. **Load** — Did the jQuery request succeed?
3. **Mode** — noConflict / WordPress?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/browser/jquery-is-not-defined)
