Skip to content

Instantly share code, notes, and snippets.

@IGGY-MODEL
Created March 17, 2016 12:00
Show Gist options
  • Select an option

  • Save IGGY-MODEL/276ce5bd0da78a3c238c to your computer and use it in GitHub Desktop.

Select an option

Save IGGY-MODEL/276ce5bd0da78a3c238c to your computer and use it in GitHub Desktop.
Счетчик товаров
button(data-id="9").minus
input(type="text" placeholder="1" value="1").item-count-9
button(data-id="9").plus
$('.minus').click(function () {
var itemId = $(this).data('id');
var input = $('.item-count-' + itemId);
var count = parseInt(input.val()) - 1;
count = count < 1 ? 1 : count;
input.val(count);
input.change();
return false;
});
$('.plus').click(function () {
var itemId = $(this).data('id');
var input = $('.item-count-' + itemId);
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