October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Fix the “jQuery $ Is Not Defined” Error

The “$ is not defined” error means the failing code cannot access jQuery’s alias. Check the script request and execution order, then resolve any conflict over the $ name.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The browser reached code that uses $ before a usable jQuery reference was available. Check that jQuery loaded, then make sure it runs before any plugin or application code that depends on it. If another library uses $, switch to jQuery or a separate alias. A DOM-ready handler cannot fix a missing library or incorrect script order.

What “$ is not defined” means

In jQuery, $ is a shorthand alias for the jQuery function. But JavaScript does not reserve $ for jQuery: another library, a local scope, or a page configuration can leave it unavailable as a jQuery reference. The error text alone does not reveal which cause applies, so start with the failing line and whether the jQuery file actually loaded.

jQuery’s noConflict() API documents that another library may use $ and explains how to relinquish jQuery’s control of that name.

Diagnose the cause before changing code

  1. Find the first relevant console error. Open your browser’s developer tools and identify the exact line that first fails. Later errors may be consequences of that first failure.
  2. Check the jQuery request in Network. Look for the script request and confirm its URL is correct and that it completed successfully rather than failing or being blocked. A blocked script fires an error event, as described in MDN’s <script> reference.
  3. Inspect the rendered script tags. Confirm that jQuery appears before every plugin or application script that calls $ while it is being evaluated. Check the rendered page, not just a template or source file that may differ from what the browser receives.
  4. Check script attributes and execution context. Related scripts marked async can execute as soon as each file is available, with no guaranteed order. If the error occurs only in one bundle, callback, or interaction, inspect that exact line and context: the identifier may not be available in that scope or at that time.

Fix the loading or order problem

If the jQuery request is missing or fails

Correct the script URL or the way the file is delivered, then reload and verify the request succeeds. A dependent script cannot call jQuery if the browser never received and executed the intended jQuery file. Avoid adding a second copy as a guess: jQuery advises against loading two versions, and a duplicate can introduce its own conflicts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

If dependent code runs before jQuery

Put jQuery before its plugins and application code. For classic external scripts, defer lets the browser parse the document before executing the scripts, while preserving the order of the script elements. Keep all dependent classic scripts deferred and list them in dependency order:

<script defer src="/js/jquery.min.js"></script>
<script defer src="/js/plugin-that-needs-jquery.js"></script>
<script defer src="/js/app.js"></script>

This assumes each URL returns the intended file and the plugin and application are compatible with the jQuery version in use. MDN states that deferred scripts execute in document order. Do not rely on that rule for async scripts; remove async from scripts with dependencies or use an explicit dependency-management approach instead.

Rank #2
Sale
JavaScript and jQuery: Interactive Front-End Web Development
  • JavaScript Jquery
  • Introduces core programming concepts in JavaScript and jQuery
  • Uses clear descriptions, inspiring examples, and easy-to-follow diagrams

This guidance concerns classic scripts. Module scripts defer by default, and the defer attribute has no effect on them. If the page uses modules, verify its module imports and execution context rather than applying classic-script ordering advice blindly.

Resolve a conflict over the $ name

If jQuery is available but $ belongs to another library—or is not available where your code runs—use the full jQuery name. Alternatively, after jQuery loads, call jQuery.noConflict() and use the returned jQuery object under a distinct alias:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<script src="/js/jquery.min.js"></script>
<script>
  var $j = jQuery.noConflict();
  $j(function () {
    $j(".notice").addClass("ready");
  });
</script>

Call noConflict() after jQuery has loaded and before using the alias. Then use that alias consistently in the code that needs jQuery. See the jQuery Learning Center’s guide to avoiding conflicts with other libraries.

Choose the fix that matches the evidence

What you find Likely cause What to do
The jQuery request is missing, failed, blocked, or points to the wrong file jQuery did not become available Correct the URL or delivery and verify the request succeeds. MDN
jQuery appears after a plugin or application script Dependency order is reversed Load jQuery first; preserve that order if using deferred classic scripts. MDN
Related scripts use async They may execute in an unexpected order Remove async from dependency-bound scripts or use ordered defer or explicit dependency management. MDN
jQuery exists, but $ resolves to another library or is unavailable in the failing scope A name conflict or scoped alias Use jQuery or set up a noConflict() alias after jQuery loads. jQuery API; jQuery Learning Center
The error appears only in one bundle, callback, or interaction The identifier’s scope or execution timing differs there Inspect the failing line and execution context; confirm which identifier is in scope. The specific cause depends on the application.

Retest the behavior that failed

Reload the page after making the change, check the console and Network panel again, and repeat the specific interaction that originally triggered the error. A disappearing console message is not enough: confirm that the dependent plugin or application behavior now works.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why a ready handler is not the fix

A jQuery ready handler waits for the document to be ready; it does not download a missing library, repair a failed request, or make unordered scripts execute in dependency order. First make jQuery available to the failing code, then use a ready handler if the code also needs the DOM to be ready.

Quick Recap

SaleBestseller No. 1
Web Design with HTML, CSS, JavaScript and jQuery Set
Web Design with HTML, CSS, JavaScript and jQuery Set
Brand: Wiley; Set of 2 Volumes
$35.05
SaleBestseller No. 2
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript and jQuery: Interactive Front-End Web Development
JavaScript Jquery; Introduces core programming concepts in JavaScript and jQuery; Uses clear descriptions, inspiring examples, and easy-to-follow diagrams
$22.75

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.