How can I add the corresponding values when each button is clicked?
With my current script it almost works but it adds each of the previous values instead of just adding the current value:
jQuery(function() {
total = 0;
jQuery("input").click(function() {
jQuery("input:checked").not('input[value="reset"]').each(function() {
total += parseFloat(jQuery(this).val());
});
jQuery("#Totalcost").html("Save up to " + total + "%");
});
jQuery('input[value="reset"]').click(function(){
jQuery('span#Totalcost').html("Calculate your Savings!");
total = 0;
});
});