JS Code working fine in Chrome but not working in Mozilla firefox

I am removing items from Cart with updating the cart when minus buton in quantity selector is clicked. Below is the code: document.addEventListener('DOMContentLoaded', function() { console.log('Script is running'); var plusButtons = document.querySelectorAll('.plus'); var minusButtons = document.querySelectorAll('.minus'); plusButtons.forEach(function(button) { button.addEventListener('click', function(event) { event.preventDefault(); alert("button clicked"); var quantityDiv = button.closest('.quantity'); var input = quantityDiv.querySelector('.quantity-input'); var currentQuantity = parseInt(input.value); var inventoryQuantity = parseInt(quantityDiv.getAttribute('data-inventory-quantity')); if (currentQuantity + 1 > inventoryQuantity) { alert('You cannot add more than the available stock.'); } else { updateCartQuantity(button.getAttribute('data-line'), currentQuantity + 1, input); } }); }); minusButtons.forEach(function(button) { button.addEventListener('click', function(event) { event.preventDefault(); var quantityDiv = button.closest('.quantity'); var input = quantityDiv.querySelector('.quantity-input'); var currentQuantity = parseInt(input.value); if (currentQuantity > 0) { updateCartQuantity(button.getAttribute('data-line'), currentQuantity - 1, input); } }); }); This code is working fine in Chrome browser . But in mozilla firefox the function is not executed . This is a shopify website.

Comment (0)

You’ll be in good company