Skip to content

Instantly share code, notes, and snippets.

@flayder
Created February 2, 2016 12:46
Show Gist options
  • Select an option

  • Save flayder/46d054de4cfcfa658838 to your computer and use it in GitHub Desktop.

Select an option

Save flayder/46d054de4cfcfa658838 to your computer and use it in GitHub Desktop.
<script type="text/javascript" >
$(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;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment