Skip to content

Instantly share code, notes, and snippets.

@dpmango
Last active February 3, 2018 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpmango/aee41381729c602a0bd8da54f3db29a6 to your computer and use it in GitHub Desktop.
Save dpmango/aee41381729c602a0bd8da54f3db29a6 to your computer and use it in GitHub Desktop.
$('.ui-number span').on('click', function(e){
var element = $(this).parent().find('input');
var currentValue = parseInt($(this).parent().find('input').val()) || 0;
if( $(this).data('action') == 'minus' ){
if(currentValue <= 1){
return false;
}else{
element.val( currentValue - 1 );
}
} else if( $(this).data('action') == 'plus' ){
if(currentValue >= 99){
return false;
} else{
element.val( currentValue + 1 );
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment