Hello guys
I have a problem with jquery this my code:
var count = $(".count");
$('.minus').on('click', function () {
if (count.val() > 1)
count.val(parseInt($(".count").val()) - 1);
});
$('.plus').on('click', function () {
count.val(parseInt($(".count").val()) + 1);
});
and HTML code:
for first product and other products:
<td>
<input type="button" id="minusInCart" class="minus" value="-">
<input id="quantityInCart" class="count" type="text" name="quantity" value="<?= $cartItem->quantity ?>">
<input type="button" id="plusInCart" class="plus" value="+">
</td>
the problem is when i try to press + or - it will count the first product and other products.
I want when I press on + or - to count the product that reference to the same product I'm in
note: this example on my cartItems table
how to do that please help!