I have a problem with JQuery, I do not understand why it adds up well sometimes and sometimes badly.
My code to calculate is as follows:
var sum=0;
$('.subtotal').each(function() {
sum += parseFloat($(this).text());
});
$('#resultado_total').val(sum.toFixed(2));
My table is as follows:
<table class="table table-condensed table-hover table-striped ">
<tr>
<th class='text-center'>Estado </th>
<th class='text-right'>Total</th>
</tr>
<tr>
<td class='text-center'><?php echo $estado;?></td>
<td class='text-right subtotal'><?php echo number_format($total,2);?></td>
</tr>
</table>
Waiting for your support! thanks in advance!