开发者

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 开发者_StackOverflow中文版multiplication working along with the additions?

Any help would be greatly appreciated.


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


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;       
}


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜