このコードはありますが、正しく機能していません。複数の入力値が1つの合計を加算または減算する
アイデアは、すべての入力に値があり、上下をクリックすることによって合計値からその値を減算することです。
今はちょうど追加と追加と狂気のような追加です。
ありがとうございました。
JS
: ここでは例$(document).ready(function() {
$(".quantity").each(function(){
$(this).change(function(){
var quantity = ($(this).val());
var ammount = ($(this).attr("data-price"));
var price = $(this).closest(".bookSection").find(".item_price").html();
var subtotal = ammount * quantity;
var total = parseInt(subtotal) + parseInt(price);
$(this).closest(".bookSection").find(".item_price").html(total);
});
});
});
:http://jsbin.com/tolequyobi/1/edit?html,js,output
のようなものに数量が変わるたびに行うことができます。あなたは決して価格から何も引くことはありません。 – Jerrad