$(document).ready(function(){
$(".text").change(function(event)
{
txtBoxCalcAmtPaid();
});
});
function txtBoxCalcAmtPaid(){
//When the user changes the amount due the checked line items are added to the 'Payment Amount' textbox
var sum = 0;
$.each($(".check"), function(i,v)
{
var theElement = $(v);
if(v.checked)
{
var theValue = theElement.val();
sum += parseFloat(document.getElementById("txtAmountPaid" + theValue).value);
}
else
{
//clear the txtAmountPaid field if the checkbox is not checked
var theValue = theElement.val();
document.getElementById("txtAmountPaid" + theValue).value = '';
}
});
document.getElementById("txtPaymentAmt").value = FormatCurrency(sum);
}
|