My jQuery isn't working when I add it too common.js

Hi All,

I’m really new to Sage9 and have only just started using it today.

I’m trying to add some jQuery:

When I add it to common.js file it doesn’t work at all. Any ideas why this may be?


If you haven’t already, I recommend reading through all of our Sage documentation. Specifically, make sure you’ve run the build process to compile your JavaScript. Also, make sure that you’re putting your code into init() or finalize() method in common.js.


So I re-read the documentation. I thought I’d tried ‘yarn build’ instead of ‘yarn start’, when I run yarn build and view my site then the jQuery works perfectly. But when I run yarn start it doesn’t. Any ideas why? There’s no errors logged in terminal.


When you run yarn start and the jQuery doesn’t work, what URL are you accessing your site on?

yarn start refreshes your JS and CSS by inserting them directly into the DOM instead of writing new versions of the files and then reloading the page. This can cause issues in certain circumstances, ie if you’ve enqueued your JS files in a nonstandard way. Without seeing your code, and knowing how you’ve modified Sage, it can be difficult for us to troubleshoot.

This topic was automatically closed after 42 days. New replies are no longer allowed.