var App_BattleDonation_Form = { idForm: null, idTotalAmount: 'donation-total-amount', init: function (idForm) { App_BattleDonation_Form.idForm = idForm; $('#' + idForm + ' input[name="amount[]"]:checkbox').change(function(){App_BattleDonation_Form.checkboxOnChange()}); App_BattleDonation_Form.checkboxOnChange(); }, checkboxOnChange: function () { var totalAmount = 0.0; $('#' + App_BattleDonation_Form.idForm + ' input[name="amount[]"]:checkbox:checked').each(function(){ totalAmount+= floatval(this.value); }); $('#' + App_BattleDonation_Form.idTotalAmount).html('$' + number_format(totalAmount, 0, '.', ',')); }, onSuccess: function(idForm) { var response = Qs_Form.getFormOption(idForm, 'response'); Qs_Http.redirect(response.url); } };