Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Multiple versions of jQuery or React loaded: how to find and fix it

PRF-046Low impactOther toolBy FunnelGuardPublished Updated
On this page

What this issue is

A page has multiple versions of jQuery or React loaded when two or more copies of the same library are downloaded and run. It usually happens by accident. A theme ships its own jQuery, a plugin adds another from a CDN (a public file host), and a page builder or embedded widget brings a third.

With jQuery, each copy sets up its own $ and jQuery object. The last one loaded wins the global name, so plugins that registered on the earlier copy can disappear. With React, two copies in one app can break hooks, with the error Invalid hook call, because components and the renderer must share one instance.

Why it costs you leads or sales

The direct cost is speed. Every extra copy must be downloaded, parsed and run on the main thread, the single lane where the browser also handles taps and clicks. A busy main thread can delay the response to a click on your form button or checkout.

The bigger risk is breakage. A jQuery plugin that handles form validation, a date picker, a popup or a slider may be attached to the old copy and silently stop working. Visitors then click and nothing happens. The business impact is usually low when the page still works, but it rises sharply if the duplicate breaks a form or a payment step.

Script weight added by duplicate librariesExample numbers
Script weight added by duplicate libraries (example)One jQuery copy: 90 KB; Two jQuery copies: 180 KB; Two jQuery plus jQuery Migrate: 195 KB07514990180195One jQuery copyTwo jQuery copiesTwo jQuery plus jQuer…KB

Example: approximate minified size of extra copies. Real sizes depend on the versions and plugins you load.

How a duplicate jQuery breaks a form
  1. Theme loads jQuery 3.7Form plugin attaches to it
  2. Widget loads jQuery 1.12Replaces the global $
  3. Plugin call failsValidation or submit handler missing
  4. Lead not sentVisitor clicks, nothing happens

The second copy replaces the global $, so the plugin registered on the first copy is gone.

How to check if your site has it

Find duplicate libraries in your browser
  1. Open the page in Chrome

    Use a private window so extensions do not add scripts. Open DevTools with F12 or Cmd+Option+I.

  2. List the loaded scripts

    Go to the Network tab, filter by JS, reload, and search for jquery, react and react-dom. More than one file name or version for the same library is a duplicate.

  3. Check the live jQuery version

    In the Console tab, run jQuery.fn.jquery. This shows the version that won the global name.

  4. Look for hidden copies

    Run the snippet below. It lists every script URL that contains jquery or react.

  5. Run a Lighthouse audit

    In the Lighthouse tab, run a Performance report and open the Diagnostics. Look for duplicated JavaScript and large script bundles.

List scripts that look like jQuery or Reactjavascript
[...document.scripts]
  .map(s => s.src)
  .filter(src => /jquery|react/i.test(src))
  .forEach(src => console.log(src));

How to fix it

The goal is one copy of each library, at a version every script that needs it supports. Work out which file or plugin adds the extra copy, then remove it or point it at the shared one. Test on a staging copy first, because older plugins may depend on old jQuery features.

Remove the extra copy on your platform
  1. Find who loads it

    Deactivate plugins one at a time on staging and reload the Network tab until the extra jQuery file disappears. The Query Monitor plugin also lists scripts by the plugin or theme that enqueued them.

  2. Use the bundled jQuery

    WordPress ships its own jQuery. Ask the plugin or theme author to use it, or update them. Avoid code that deregisters jQuery and loads a CDN copy unless you must.

  3. Dequeue the duplicate if needed

    In a child theme or small plugin, remove the extra script handle with wp_dequeue_script, using the handle shown in Query Monitor.

Find duplicate React packages in a projectbash
npm ls react react-dom
npm dedupe

How to confirm it's fixed

Confirm one copy of each library
  • The Network tab shows only one jQuery file (and one React build) after a hard reload
  • jQuery.fn.jquery in the Console returns the version you chose
  • The Console shows no errors such as $ is not a function or Invalid hook call
  • Your forms validate and submit, and test leads arrive
  • Popups, sliders and date pickers still work
  • Lighthouse shows less JavaScript than before

How to prevent it happening again

Habits that keep libraries single
  • Check the Network tab after adding any plugin, app, theme or widget
  • Prefer plugins that use the library already on the site
  • Avoid pasting CDN script tags for jQuery into custom code or tag manager
  • Use dependency dedupe and a bundle analyzer in your build
  • Test changes on staging and record which scripts load
  • Review third-party scripts every few months

How FunnelGuard handles this

This issue is outside what FunnelGuard checks. It is a code and performance matter that needs a different kind of tool: a browser auditing tool such as Chrome DevTools or Lighthouse, or a bundle analyzer for your build.

FunnelGuard is a synthetic monitoring service that runs your real customer journeys on a schedule, such as lead forms and checkouts, and checks each step. It does not inspect which library versions your page loads. Once you have fixed the duplicates, running your key journeys is a useful way to see whether your forms and buttons still work end to end. The Free plan covers 1 site and 2 journeys with daily checks, no card needed.

Questions people ask

Why is my site loading jQuery twice?

Usually a theme and a plugin, app or embedded widget each add their own copy. Open the Network tab, filter by JS and search for jquery to see which files load. Then disable plugins or apps one at a time on staging to find the source.

How do I check which version of jQuery my site uses?

Open the browser Console and run jQuery.fn.jquery. It returns the version of the copy that currently owns the global name. To see every copy, check the Network tab or list script URLs with document.scripts.

Can two versions of jQuery break my form?

Yes. The later copy replaces the global $, so plugins registered on the earlier copy, such as validation or masks, can stop working. The form may then fail to validate or submit without showing an obvious error.

What does Invalid hook call mean in React?

One common cause is two copies of React in the same app, so hooks run against a different instance than the one rendering. Run npm ls react react-dom to find duplicates and dedupe them so one copy is used.

Does loading jQuery twice hurt page speed?

Yes. Each copy has to be downloaded, parsed and run, which adds work on the main thread that also handles clicks. The size of the effect depends on versions and caching, so measure with Lighthouse before and after.

Is it safe to remove the older jQuery version?

Only after testing. Older plugins may use features removed in jQuery 3. Try it on staging, use jQuery Migrate to spot deprecated calls, and check forms, popups and checkout before going live.

Can FunnelGuard detect duplicate jQuery or React?

No. That needs a browser auditing tool such as Chrome DevTools or Lighthouse, or a bundle analyzer. FunnelGuard instead runs your real journeys, like forms and checkouts, to check they complete.

Does FunnelGuard catch this?

Other tool

Needs a different kind of tool.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.