I need to show the total ( .total
) of each row ( .numero
).
Obviously my problem is the loop
that I am doing wrong.
Right now I have the following code:
<table id="tabla" border="1">
<thead>
<tr>
<td>Numero</td>
<td>total</td>
</tr>
</thead>
<tbody>
<tr>
<td class="numero">1</td>
<td class="total"></td>
</tr>
<tr>
<td class="numero">2</td>
<td class="total"></td>
</tr>
</tbody>
</table>
$(document).ready(function()
{
$(document).on('focusout','#factor',function()
{
$("#tabla").each(function()
{
var factor = $("#factor").val();
var numero = $("#tabla tbody tr").siblings().text();
var r = parseInt(factor) + parseInt(numero);
$(".total").text(r);
console.log(r);
})
})
});