I have a table with 5 rows consisting of 5 input boxes that a user will enter a number in and i have 5 checkboxes in the next column
I want to be able to total based on wether the checkbox is checked
Code:
function total_credit_payoff()
{
if document.getElementById("debtpayoff1").checked{
othercredit1 = parseFloat(document.getElementById("credC1").value);
othercredit2 = parseFloat(document.getElementById("credC2").value);
othercredit3 = parseFloat(document.getElementById("credC3").value);
othercredit4 = parseFloat(document.getElementById("credC4").value);
auto1 = parseFloat(document.getElementById("auto1").value);
totalcreditbal = othercredit1 + othercredit2 + othercredit3 + othercredit4 + auto1
}
In other words if the checkbox next to the input field is checked then the amount gets added to the total otherwise if the box is NOT checked it does not get added
Thanks