Created
March 17, 2016 12:00
-
-
Save IGGY-MODEL/276ce5bd0da78a3c238c to your computer and use it in GitHub Desktop.
Счетчик товаров
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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