Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sealucky7/e9ac6e5de508e067d7c89c8d8691e395 to your computer and use it in GitHub Desktop.
Save sealucky7/e9ac6e5de508e067d7c89c8d8691e395 to your computer and use it in GitHub Desktop.
<span class="form-group">
<span id="decrease">-</span>
<input id="htop" type="text" value="1">
<span id="increase">+</span>
</span>
var elm = $('#htop');
function spin( vl ) {
elm.val( parseInt( elm.val(), 10 ) + vl );
}
$('#increase').click( function() { spin( 1 ); } );
$('#decrease').click( function() { if (elm.val () > 0 ){spin( -1 ); } });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment