javascript - How can I perform an add function using jQuery -
i'm new javascript , need perform function! scenario is, there 2 elements used increase , decrease numerical value. value shown in element. i've shown image elements are! how can using javascript?
update :
i wrote following jquery function element click event. result doesn't change when click element.
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); )); });
here html element map.
<div class="bill-item-description"> <!-- section item description , 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 increment & decrement of item amount goes --> <a class="amount-increase" href="#"></a> <a class="amount-decrease" href="#"></a> </div>
http://jsfiddle.net/praveen16oct90/qkgzb/
take @ this.. created u...
$(document).ready(function() { var x=2; $("#increase").click(function() { x+=1; $("#price").html(x); }); });
Comments
Post a Comment