samedi 19 décembre 2015

Re-calculate total value on select field change [on hold]

I have a form with several checkboxes and a few select boxes that can be used to check several checkboxes at once. At the end of the form it displays the summed value of the checkboxes.

This summed value is calculated by the following jQuery:

jQuery(".choice:checked").each(function() {
        total += parseInt(jQuery(this).val());
    });

This does the job, but has one problem. It doesn't re-calculate the value when I pick another option on a select field (and thus let jQuery check or un-check some checkboxes). If I check another checkbox myself the summed value is then correct. Does someone know why this isn't re-calculated when I pick another option?




Aucun commentaire:

Enregistrer un commentaire