Skip to content

Errors / JavaScript errors

Uncaught ReferenceError: $ is not defined (or jQuery is not defined)

A script needs jQuery and ran before jQuery was on the page, or jQuery never loaded.

Every jQuery feature on the page is dead: menus, sliders, pop-ups, form validation.

Why it happens

  • jQuery is loaded after the script that uses it, or with async/defer while the other script is not.
  • A performance plugin moved jQuery to the footer or delayed it, and inline scripts in the page still expect it at once.
  • WordPress loads jQuery in no-conflict mode, where $ is not defined but jQuery is.
  • The jQuery file failed to load: a CDN blocked, a wrong path after a migration.

How to fix it

  1. Load jQuery first and without async; on WordPress, enqueue your script with jquery as a dependency.
  2. In WordPress, write jQuery(function ($) { … }) so $ exists inside.
  3. If a speed plugin defers JavaScript, exclude jQuery and the scripts that need it inline.
  4. Check the jQuery request itself answered 200.

Whose problem it is

Usually the site's own code or settings.

Does your site have it?

Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.

Check only sites you run or have permission to check.

Often seen with

  • x is not definedA script used a name nobody declared, usually because another script it depends on did not load first.
  • x is not a functionA script tried to use something as an action that is not one, and stopped.