Hoping someone can help me here because I can’t figure out what’s going on
I’m trying to add an event listener to this Shopify Add to Cart button, in Firefox I can see that the ‘click’ event is being added to button, however the code isn’t being fired
Code I’m using and have used many times for other small scripts
Update – Seems like it’s caused because of the type="submit"
but that’s needed, so I’m not sure how to work around it
const addToCartButton = document.querySelector('[data-add-to-cart]');
addToCartButton.addEventListener("click", () => {
console.log('clicked')
});