更新时间:2023-10-05 20:57:16
你已经知道了,只需要为合适的选择器稍微调整你的 JQuery
You pretty much had it, just needed to adjust your JQuery a little bit for the appropriate selectors
更新小提琴:http://jsfiddle.net/5gsBV/7/
$(document).on("change", ".qty1", function() {
var sum = 0;
$(".qty1").each(function(){
sum += +$(this).val();
});
$(".total").val(sum);
});