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

Still need help?

The Atlassian Community is here for you.

Ask the community

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. 

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:

    <script type="text/javascript">
    var $ = jQuery;
    </script>
Last modified on Feb 19, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.