mardi 3 novembre 2015

Calculate total with checkbox and select dropdowns

Does anyone know the best method to calculate the total of checkbox / select values in a package style format?

For example:

I select website at £50, the total is £50 I select a logo at £15, the total is now £65 I select 2 from licences (£5 each) from a drop down, the total is now £75

I have this fiddle so far: http://ift.tt/1Q8UDJp which has the checkbox functionality I'm after, but I'm failing at the select option hurdle.

$('select#office').change(function() {
    var number = $(this).find('option:selected').text();
    //alert(number);
    add += number;
});

Can anyone point me in the right direction? I've had a look through various resources.




Aucun commentaire:

Enregistrer un commentaire