-2
所以,我在此列的底部有一个“总”字段。加入价格单价检查时,减去价格时unchcked
高于这个领域是复选框,选中时,在“总”应该通过增加复选框的价格更新,取消选中和时,价格应该被删除。
如此的相似,http://www.tepilo.com/#packages-anc
下面的代码的东西更新时,点击复选框
它什么都不做时的价格未点击
再次点击时,它增加了新的当前价格
$('.col-2 input[type="checkbox"]').on('click', function() {
var attribute_name = $(this).val();
var attribute_price = settings.wsapo_custom[0][attribute_name].price;
var current_price_total = $(".col-2 #update-price").text();
var new_price = parseInt(current_price_total) + parseInt(attribute_price);
console.log(new_price);
$(".col-2 #update-price").text(new_price);
});
在此先感谢
感谢您的评论,我见过的代码工作完美罚款在那小提琴。但由于某些原因,它仍然没有工作 这里的情景 原来的数字是195 当我选中该复选框,就成了295 - (这就是预期) 当我取消它,它成为95 - 这不是预期,我不知道发生了什么 – 2015-01-04 17:37:16
嗯,这可能是因为它从195减去100,而不是从295减去100。 – JiFus 2015-01-04 19:10:48