I have a problem that I can not solve. I have a sales order screen where it has to do the quantity calculation X unit value = (fill in the total value and add up to the total of the order), how do I To do this calculation with jquery someone can help me follow part of the code below.
<table id="table-itens" class="table table-bordered table-hover table-striped">
<thead>
<tr class='info'><th colspan='6'>Itens do pedido de venda</th></tr>
<th class="th_codigo">Produto</th>
<th>Quantidade</th>
<th class="th_unitario">Valor Unit.</th>
<th class="th_total">Total</th>
</thead>
<tbody>
<tr id='line1' >
<td><input type='text' class='form-control input-sm codigo' value='29832' disabled /></td>
<td class='class_quant'> <input class='form-control input-sm codigo' type='text' name='ITEMARRAY[1][quantidade]' value='' id='qtn02' required/></td>
<td class='class_unit'> <input class='form-control input-sm vlr_unitario' type='tel' name='ITEMARRAY[1][vlr_unitario]' id='valor_unitario03' required /></td>
<td class='class_total'> <input class='form-control input-sm total' type='text' name='ITEMARRAY[1][total]' id='total02' readonly='readonly' /></td>
</tr>
<tr id='line2' >
<td><input type='text' class='form-control input-sm codigo' value='29835' disabled /></td>
<td class='class_quant'> <input class='form-control input-sm codigo' type='text' name='ITEMARRAY[3][quantidade]' value='' id='qtn02' required/></td>
<td class='class_unit'> <input class='form-control input-sm vlr_unitario' type='tel' name='ITEMARRAY[3][vlr_unitario]' id='valor_unitario03' required /></td>
<td class='class_total'> <input class='form-control input-sm total' type='text' name='ITEMARRAY[3][total]' id='total02' readonly='readonly' /></td>
</tr>
<tr class='info'>
<td colspan='3'></td>
<td class='total' colspan='2'><b>Total do pedido R$ : </b></td>
<td><div id='total'><span class='value_total'></span> </div></td>
</tr>
</tbody>
</table>
My jquery code is like this, the same is already calculating the values of the lines but I can not fill in the total value of the line just by going over the field has some automatic way of doing this when filling the quantity and unit value it ja Does the total of the line trigger and sum in total?
$(window).ready(function () {
$('#table-itens tr td.class_quant').keyup(function () {
var quantidade = $(this).find('#qtn02').val();
$('#table-itens tr td.class_unit').keyup(function () {
valor_unitario = $(this).find('#valor_unitario03').val();
var total = (quantidade * valor_unitario);
$('#table-itens tr td.class_total').keyup(function () {
$(this).find('#total02').attr('value', total);
});
});
});
});