I am using number field with plus and minus for product quantity select for a project. I need to set a max limit when I press plus icon. I am using below code
$(document).ready(function() {
$('.minus').click(function () {
var $input = $(this).parent().find('input');
var count = parseInt($input.val()) - 1;
count = count < 1 ? 1 : count;
$input.val(count);
$input.change();
return false;
});
$('.plus').click(function () {
var $input = $(this).parent().find('input');
$input.val(parseInt($input.val()) + 1 );
$input.change();
return false;
});
});
How to set a maximum limit for when i press + icon.