Why does this code only work on my live server but not on Shopify?

NoahOnyejese
Excursionist
29 0 6

Hi guys 

 

I have a javascript code that works perfectly fine on my live server but stops working on Shopify. Can you find the mistake?

 

const form = document.querySelector('form');
const color = document.querySelectorAll('.main');

document.querySelector('form').addEventListener('change', function(e) {

  var colorCodeD = [...form.querySelectorAll('input[type=radio]:checked')].map(element => element.value).join('');

  color.forEach(element => {
    element.classList.toggle('color1', colorCodeD === 's1');
  })
  selected.innerHTML = colorCodeD;
});
Reply 1 (1)
alexhensen562
Visitor
1 0 0

Hi all, the issue I'm having right now is my collection images are showing up with a black background. I've made sure that they have a transparent '