Lucille
Lucille

Reputation: 93

jQuery multiply and addition not adding total value

Please take a look at the following URL: http://jsfiddle.net/XBtgD/2/.

The additions are working fine, however the multiplication part doesn't add up at all.

Any ideas on how to get the multiplication working along with the additions?

Any help would be greatly appreciated.

Upvotes: 1

Views: 385

Answers (3)

eric.seitz
eric.seitz

Reputation: 26

Need the :checked

function calcWM()
{

    var a = parseInt( $('input:radio[name=package]:checked').val());
    alert(a);
    var b = parseInt( $('input:radio[name=job]:checked').val());
    var c = parseInt( $('input:radio[name=months]:checked').val());
    a = isNaN(a) ? 0 : a;
    b = isNaN(b) ? 0 : b;
    c = isNaN(c) ? 0 : c;

    wmValue = a * b * c;       
}

Upvotes: 1

Joe
Joe

Reputation: 82594

You have class="sum" for you sums, but you are missing class="mult" for the multiple inputs.

Upvotes: 2

Alexander
Alexander

Reputation: 2052

For starters there are no inputs with class "mult", and I suppose the multiplication function should do a

total *= parseInt(value) 

...instead of a

total += parseInt(value)

Upvotes: 0

Related Questions