【发布时间】:2021-04-12 12:38:55
【问题描述】:
有人知道如何 + 和 * 选择单选值并显示结果吗?
在小提琴中> itemOne + itemTwo * itemThree =
设法选择值并计算出数学,但很难将它们结合在一起。
非常感谢您的宝贵时间!
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;
【问题讨论】:
标签: radio