Im trying to increment Quantity for second row only but the first row that increment and not the second ?!
this is my code Html of my table :
<table class="table">
<thead>
<tr>
<th class="">Item Name</th>
<th class="">Item Price</th>
<th class="">Quantité</th>
<th class="">Actions</th>
</tr>
</thead>
@foreach(var item in @Model.panierWebs)
{
<tbody>
<tr class="">
<td class="">
<div class="product-info">
<img width="80" src="@Url.Content(item.Image)" alt="" />
<a href="#!"> @Html.DisplayFor(modelItem => item.Model) </a>
</div>
</td>
<td class=""> @Html.DisplayFor(modelItem => item.Prix) DA</td>
<td class="">
<div class="quantity buttons_added">
<input onclick="decrement(@item.Prix,@item.Qte)" type="button" value="-" class="minus"><input type="number" name="quantity" id="qte" value="@item.Qte" title="Qty" class="input-text qty text" pattern="" inputmode=""><input onclick="increment(@item.Prix,@item.Qte)" type="button" value="+" class="plus">
<td class="">
<a onclick="remove(@item.Id)" class="product-remove" href="#!">Remove</a>
</td>
</tr>
</tbody>
}
</table>
and my Script JS of increment and decrement Qte :
<script>
function decrement(prix,qte)
{
console.log(“qte avant dec”+document.getElementById(“qte”).value);
if(parseInt(document.getElementById("qte").value) != 1)
{
qte=parseInt(document.getElementById("qte").value)-1; // increment qte
console.log("qte apres dec"+qte);
$("#qte").val(qte); // affecter la nouvelle valeur de qte
var currenttotal=document.getElementById("total").value; // calculer le nouveau total
var newtotal = parseFloat(currenttotal)-parseFloat(prix);
$("#total").val(newtotal);
}
}
function increment(prix,qte)
{
console.log(“qte avant incr”+document.getElementById(“qte”).value);
if(parseInt(document.getElementById(“qte”).value)