JavaScript errors when JQuery object $ is not available in the global scope
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
- Go to the "Custom HTML" section of the Confluence Administration Console.
Add the following code block to the "At end of the HEAD" section:
<script type="text/javascript"> var $ = jQuery; </script>