JavaScript errors when JQuery object $ is not available in the global scope

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Symptoms

Some functionality provided by JavaScript does not work in the browser.

Diagnosis

In the Java console of your browser, you will find the following errors:

  • Firefox: TypeError: $ is undefined

  • Chrome: Uncaught TypeError: Cannot read property 'XXXX' of undefined

  • IE10: Unable to get property 'XXXX' of undefined or null reference

Because this is a client-side error, there will be nothing in Confluence logs regarding this problem.

Cause

This is caused because the jQuery object $ is not available in the global scope. This can be caused by disabling some system plugins. Some other customizations or third party plugins may also lead to this problem.

Solution

Workaround

  1. Go to the "Custom HTML" section of the Confluence Administration Console.

  2. Add the following code block to the "At end of the HEAD" section:

    1 2 3 <script type="text/javascript"> var $ = jQuery; </script>
Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.