Hello I am trying to do a simple calculation of three values: a + b * c but getting wrong total. If a is 10 and b is 10 it would be 20 multiplied by c which is 2.4. I should get 48 as total. Currently getting 2424.
function compute() {
var a = $('#a').val();
var b = $('#b').val();
var c = $('#c').val();
var total = (a + b) * c;
$('#total').val(total);
}
$('#a, #b, #c').change(compute);
try after parsing the values like:
var total = (parseFloat(a) + parseFloat(b)) * parseFloat(c);