Test environment not mimicking production environment

Hi! I am curious to know if I am missing a key piece here. I have developed a custom module to incorporate into a theme I have (Clean Theme in my case). I’ve cloned the original theme and built my custom module within my child theme. My problem is that the module I built works perfectly within the test environment, but breaks as soon as I drop it into my page builder. From what I am gathering, it looks like the .js is not reading, though under inspect, it says it’s there. Any ideas as to why this may be happening?

Hi, @BMitch :waving_hand: Thanks for your question! And welcome to our community :raising_hands:

There can be many reasons this is happening. I’ll add a few common things to check:

  • JS file loading order
  • JS file scope (making sure it doesn’t execute before the required elements are loaded)
  • Conflict with other scripts (JavaScript errors or warnings in the browser’s console)
  • Caching

If you’ve checked all these things and are still having trouble, you might want to provide more details about how your module’s JavaScript is failing.

For instance,

  • are there any error messages on the console?
  • What is the expected behaviour, and what is the actual behaviour

Providing these details can make it easier for others to help you troubleshoot the problem.

Thank you! — Jaycee

Thank you Jaycee!

I still seem to be having troubles. In my test environment, I have a series of 10 radio buttons, when I click on each one, a js function runs causing a copy block to go from display: none, to display: block and an image in a grid next to it goes from an opacity of 0 to an opacity of 1 based on a specific id tied to each radio button. It works perfectly in it’s sterile environment, but when I drop it into my production environment/page builder, the function won’t run and all images disappear from this particular module. I’m also getting the following error:
Uncaught TypeError: Cannot read properties of null (reading ‘style’)

in reference to my defined function. Hopefully this helps in clarifying my problem?