Zoo/static/js/custom.js

30 lines
784 B
JavaScript

$(document).ready(function (){
$('.plus').click(function (e){
e.preventDefault();
var inc_value = $(this).closest('.product-data').find('.qty-input').val();
var value = parseInt(inc_value,10);
value = isNaN(value) ? 0: value ;
if (value < 10){
value++;
$(this).closest('.product-data').find('.qty-input').val(value);
}
})
$('.minus').click(function (e){
e.preventDefault();
var inc_value = $(this).closest('.product-data').find('.qty-input').val();
var value = parseInt(inc_value,10);
value = isNaN(value) ? 0: value ;
if (value > 0){
value--;
$(this).closest('.product-data').find('.qty-input').val(value);
}
})
})