Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Plus Minus Start*/
- $(".cart-plus-minus-button").append('<div class="dec qtybutton">-</div><div class="inc qtybutton">+</div>');
- $(".qtybutton").on("click", function() {
- var $button = $(this);
- var oldValue = $button.parent().find("input").val();
- if ($button.text() == "+") {
- var newVal = parseFloat(oldValue) + 1;
- } else {
- // Don't allow decrementing below zero
- if (oldValue > 0) {
- var newVal = parseFloat(oldValue) - 1;
- } else {
- newVal = 0;
- }
- }
- $button.parent().find("input").val(newVal);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement