这是我的小提琴: https ://jsfiddle.net/btekbtek/6gxztk4f/6/
当我输入数量时,我会自动计算价格。
我还想包括
每 1 数量增加 1 英镑的选择选项。
如果有人输入 10 数量 - 价格应该是 qty10*(£1*10)*price
目前当我添加:
// update price if option change
var optionprice = 0;
var getPriceOption = function() {
jQuery("#select_21").change(function() {
if (jQuery(this).val() === '63') {
optionprice = 0;
} else {
optionprice = 1;
}
}); //end update optionprice
return optionprice;
}; //end get PriceOption
console.log(getPriceOption);
getPriceOption 未定义。我试图在之前和相同的结果之后添加它。
我无法更改 HTML 中的任何内容,只能在 jQuery 中更改。
侃侃尔雅
相关分类