Error "$ is not a function" in Spotfire version 11.5.0 or higher

Error "$ is not a function" in Spotfire version 11.5.0 or higher

book

Article ID: KB0070578

calendar_today

Updated On:

Products Versions
Spotfire Analyst 11.5.0 or higher
Spotfire Consumer 11.5.0 or higher
Spotfire Desktop 11.5.0 or higher

Description

In Spotfire version 11.5.0, scripts that have been relying on the jQuery library previously distributed with Spotfire will now fail, as attempting to use the $ selector/jQuery alias will result in errors like the following:

Execution of Javascript failed:
Type: TypeError
Message: $ is not a function
Stacktrace: TypeError: $ is not a function


The reason for this is that from version 11.5.0, the jQuery 1.12.4 and jQuery UI 1.9.2 JavaScript libraries are no longer distributed with Spotfire. As stated in the release notes, "your use of these third party libraries, whether in this release, past releases, or future releases of TIBCO Spotfire, is at your own discretion, and is not supported or warranted by TIBCO. Please see Best Practices for Writing Custom JavaScript Code in Text Areas for additional information on using JavaScript code with Spotfire® product."

Information related to this has also been communicated previously in version 11.4.0, when the libraries were deprecated, and in version 10.0.0, when the Best Practices for Writing Custom JavaScript Code in Text Areas were communicated.
 

Issue/Introduction

After upgrading to Spotfire version 11.5.0 or higher, opening previously working analyses may now result in the error "$ is not a function". This happens if using JavaScripts that rely on the jQuery library previously distributed with Spotfire - in version 11.5.0, this has been removed.

Environment

All

Resolution

To solve this issue, follow the instructions in the Best Practices for Writing Custom JavaScript Code in Text Areas to include your own library.

Update: The ability to use jQuery specifically (but not jQueryUI) without including your own library was temporarily re-introduced for Spotfire 11.5.0 in hotfix HF-001 (https://community.spotfire.com/articles/spotfire/list-of-hotfixes-for-tibco-spotfire-clients-analyst-web-player-consumer-business-author-and-automation-services) and also from Spotfire 11.6.0, to allow for a smoother transition for users currently affected by the issue.

Additional Information

Best Practices for Writing Custom JavaScript Code in Text Areas TIBCO Spotfire 11.5.0 Release notes:  TIBCO Spotfire 11.4.0 Release notes: