Aleksmorshen commited on
Commit
f545cff
·
verified ·
1 Parent(s): 96d309a

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +2 -1
script.js CHANGED
@@ -134,7 +134,8 @@ document.addEventListener('DOMContentLoaded', function () {
134
 
135
  // Функция добавления товара в корзину
136
  window.addToCart = function (productId) {
137
- const quantityInput = document.querySelector(`tr[data-id="${productId}"] .quantity-input`);
 
138
  const quantity = parseInt(quantityInput.value);
139
 
140
  if (quantity && quantity > 0) {
 
134
 
135
  // Функция добавления товара в корзину
136
  window.addToCart = function (productId) {
137
+ const row = document.querySelector(`tr[data-id="${productId}"]`);
138
+ const quantityInput = row.querySelector('.quantity-input');
139
  const quantity = parseInt(quantityInput.value);
140
 
141
  if (quantity && quantity > 0) {