我正在制作餐厅在线菜单,需要在客户向菜单中添加项目时显示总数。但是,我的总数只更新了 1 位小数。我正在尝试使用 toFixed(2) 但无法使其正常工作。
var banquetPrice = parseInt($(document).find(".menuChoice").val());
$(".menuChoice").change(function () {
updateTotal()
});
var total = (banquetPrice * numGuests) + (9.25 * numGuac) + (9.25 * numQuesa) + (9.25 * numNachos)
$("#total").html(total);
total.toFixed(2);
任何帮助将不胜感激!