Calling jQuery from linked script

In all of our public web forms we load an external helper script from our website from within fd.rendered() using $.getScript();

Within this script we call various jQuery functions. However, invoking the $ alias within this script always triggers an error at runtime: Uncaught TypeError: $ is not a function.

In our production WordPress environment, we found we could simply replace $ with jQuery in the source code, and all works well.

However, when previewing any of our forms in the Plumsail Form Designer, using jQuery triggers a different error: Uncaught ReferenceError: jQuery is not defined.

Could you suggest any way to resolve these reference errors?

Our assumption is that it shouldn’t be necessary to load the jQuery library within our script, as this should already be resident…

Thanks!

Dear @chs-web,
It could be two things: context and variable name. You can try adding the following JS code in editor to make the jQuery object available on window level:

window.$ = $;
window.jQuery = $;

Hi Nikita,

This worked. I figured it would be something simple.

We had to switch from using ‘jQuery’ to ‘$’ in our script, but this is preferred anyway.

Thank you!