introducir el código aquí
I have the following function that works to add the amounts in inputs
that have the class monto_cierre
:
function sumamodal() {
// Para suma de montos de cierre
var total = 0;
$(".monto_cierre").each(function () {
var valorunp_v = $(this).val();
valorunp_v = valorunp_v.replace(simbolo, '');
valorunp_v = valorunp_v.replace(/\./g,'');
valorunp_v = valorunp_v.replace(',', '.');
valorunp_v = valorunp_v*100;
valorunp_v = valorunp_v/100;
valorunp_v = parseFloat(valorunp_v +0);
if (isNaN(parseFloat(valorunp_v))) {
total += 0;
} else {
total += parseFloat(valorunp_v);
}
});
total = total*100;
total_fixed = total.toFixed(2);
total_fixed = parseFloat(total_fixed + 0);
document.getElementById('total_cierre').value = total_fixed;
}
The command to execute in this way:
var intevalo = setInterval('sumamodal()',10);
This so you can do the sum of amounts in real time while they are entering the screen showing the total in a input
. It happens that I have seen that the consumption of memoria ram
in the tab where this function is running is increasing progressively, until the point where the page gives error (This after a good time).
The idea is if you can optimize this method and if there is another one so that the amounts are added in real time.