add to cart button is not responding


يرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.


my add to cart button is not responding. I have applied javascript on my add to cart button, In the cart button, I have assigned attribute i.e data-product the value that is {{}}.

var updateBtns = document.getElementsByClassName(‘update-cart’)

for (var i = 0; i < updateBtns.length; i++) {
updateBtns[i].addEventListener(‘click’, function() {
var productId = this.dataset.product
var action = this.dataset.action
console.log(‘productId:’, productId, ‘action:’, action)

<div class=”card-body”>
<h5 class=”card-title fw-bold text-uppercase”>{{}}</h5>
<p class=”card-text”>
<h4 style=”font-size: 1rem; padding: 0.3rem;
opacity: 0.8;”>$ {{product.price}} </h4>
<button data-product={{}} data-action=”add” class=”btn btn-outline-secondary add-btn update-cart”>ADD TO CART</button>

The console is not showing anything even though I click on Add to Cart button several times

X 5 أشهر 2022-07-11T16:00:36+03:00 0 إجابة 2 مشاهدات مبتدئ 0

‫أضف إجابة


مجهول يجيب