I would like to know how I could do a subtraction between the totalprice and total price2 variables and show it in the Lbtot label
Here my code:
$(function() {
$("input[type=checkbox]").change(function() {
var totalPrice = 0, ctlPrice;
$('.Gvcobranzas tr').each(function() {
if ($(this).find('input:checkbox').attr("checked")) {
ctlPrice = $(this).find('[id$= Label3]');
totalPrice += parseFloat(ctlPrice.text().replace(/[^\d\.]/g, ''));
}
});
$('.sum').text("$ " + totalPrice.toFixed(2));
});
});
$(function() {
$("input[type=checkbox]").change(function() {
var totalPrice2 = 0, ctlPrice2;
$('.GvNotasCredito2 tr').each(function() {
if ($(this).find('input:checkbox').attr("checked")) {
ctlPrice2 = $(this).find('[id$= Label20]');
totalPrice2 += parseFloat(ctlPrice2.text().replace(/[^\d\.]/g, ''));
}
});
$('.res').text("$ " + totalPrice2.toFixed(2));
});
});
}