RE: jQuery library-related error (SuiteScriptModuleLoaderError)
When I attempt to utilize any version of jQuery in a script in 2019.2 with SuiteScript 2.0, the following error will always occur. How can I resolve this issue?
Error:
TypeError: Cannot call method \”createElement\” of undefined (/SuiteScripts/Libs/jquery-2.1.3.min.js#2)
I added a config file to the script with ‘@NAmdConfig ./Libs/Config.json’ and the path is set in the config file like so:
{
“paths”: {
“jquery”: “/SuiteScripts/Libs/jquery-2.1.3.min.js”
}
}
Is this on a Server or Client side script? If it’s client side then jquery should be included by default, you just access it by using jqeury in your script rather than $. If you are trying to add to Server Side I don’t believe it will work as jQuery requires the document/window be available.