Does anyone know how to + and * selected radio values and display a result?
in the fiddle > itemOne + itemTwo * itemThree =
Managed to select the values and work out the maths, but struggling to bring it all together.
Many thanks for the time!
G
https://jsfiddle.net/omx617h8/
$(".itemOne").click(function() {
var total = 0;
$(".itemOne:checked").each(function() {
total += parseInt($(this).val());
})
$("#total1").val(total);
});
$(".itemTwo").click(function() {
var total = 0;
$(".itemTwo:checked").each(function() {
total += parseInt($(this).val());
})
$("#total2").val(total);
});
$(".itemThree").click(function() {
var total = 0;
$(".itemThree:checked").each(function() {
total += parseInt($(this).val());
})
$("#total3").val(total);
});
var a = 5;
var b = 2;
var c = 2;
var z = (a + b) * c;
document.getElementById("calculation").innerHTML = z;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…