JavaScript は初めてで、関数を実行する必要があります。基本的にシナリオとは、数値を増減するために使用される2つの要素があります。値は要素に表示されます。要素がある場所の画像を表示しました! JavaScript を使用してこれを行うにはどうすればよいですか?
アップデート :
要素のクリック イベント用に次の jQuery 関数を作成しました。しかし、要素をクリックしても結果は変わりません。
jQuery(document).ready(function(){
jQuery(".amount-increase").click(function(
var amount = parseInt($(".bill-item-amount span")text(),10);
amount = amount + 1;
$(".bill-item-amount span").text(amount);
));
});
これが HTML 要素マップです。
<div class="bill-item-description">
<!-- Section for Item description and pricing -->
<div class="bill-item-name">
<p class="bill-item-name-left">Normal Cofee</p><p class="bill-item-name-right">170.00</p>
<div class="clear"></div>
</div>
<div class="bill-item-price">
<span>170.00 USD</span>
</div>
<div class="bill-item-amount">
<span>2</span>
</div>
</div>
<div class="bill-amount-selection">
<!-- Section where the increment & decrement of item amount goes -->
<a class="amount-increase" href="#"></a>
<a class="amount-decrease" href="#"></a>
</div>