Fiddle Demo - http://jsfiddle.net/dipaks2011/6vuNP/2/
HTML
<div class="inputQty">
<span class="up">up</span>
<input type="text" maxlength="6" name="oa_quantity" class="input-quantity" value="1"/>
<span class="down">down</span>
</div>
CSS
span{ cursor: pointer;}
jQuery
$('.up').on('click',function(){
$('.input-quantity').val(parseInt($('.input-quantity').val())+1);
});
$('.down').on('click',function(){
$('.input-quantity').val(parseInt($('.input-quantity').val())-1);
});
HTML
<div class="inputQty">
<span class="up">up</span>
<input type="text" maxlength="6" name="oa_quantity" class="input-quantity" value="1"/>
<span class="down">down</span>
</div>
CSS
span{ cursor: pointer;}
jQuery
$('.up').on('click',function(){
$('.input-quantity').val(parseInt($('.input-quantity').val())+1);
});
$('.down').on('click',function(){
$('.input-quantity').val(parseInt($('.input-quantity').val())-1);
});
did you test it? there are many error and it did`t work
ReplyDeleteYes! The code is tested. Please check the Fiddle demo I have added today :)
DeleteHow to restrict it to 0 and not in minus values?
ReplyDelete