Hi, I don’t know if it’s correct but how is it an MVC project.
I have a jquery that performs an account when entering a value.
$(document).on("change keyup blur", "#startValue", function () {
var main = @ViewBag.sumMin;
var disc = $('#startValue').val();
var mult = (main * disc).toFixed(2);
$('#result').val(mult);
});
the previous code working
I also intended to do this account with a value in each row of a table
i try this:
<div>@Viewbag.sumMin;</div>
<div class="input-group">
<input type="text" class="form-control" id="startValue">
<span class="input-group-text">€</span>
<input type="text" class="input-group-text fw-bold" id="result">
</div>
<table id="tableQuant">
@foreach(var item in Model){
<tr>
<td id="numpec">
@item.listOp.where(x=>x.produ.ID_Op == i).Sum(y=>y.produ.Num_Pec)
</td>
<td>
<div class="input-group">
<span class="input-group-text">€</span>
<input type="text" class="input-group-text fw-bold" id="resultTR">
</div>
</td>
</tr>
}
</table>
$(document).on("change keyup blur", "#startValue", function() {
var disc = $('#startValue').val();
$("#tableQuant").find(''tr).each(function() {
var main = $(this).find(#numpec).val();
var mult = (main * disc).toFixed(2);
$(this).closest(''tr).find('resultTR').val(mult);
})
})
I tried closing the rows but without success, does it work through a cycle going through the IDs.
Thanks for all help.