Вот мой сценарий:
//event handler for item quantity in shopping cart
function itemQuantityHandler(p, a) {
//get current quantity from cart
var filter = /(\w+)::(\w+)/.exec(p.id);
var cart_item = cart[filter[1]][filter[2]];
var v = cart_item.quantity;
//add one
if (a.indexOf('add') != -1) {
if(v < settings.productBuyLimit) v++;
}
//substract one
if (a.indexOf('subtract') != -1) {
if (v > 1) v--;
}
//update quantity in shopping cart
$(p).find('.item-quantity').text(v);
//save new quantity to cart
cart_item.quantity = v;
//update price for item
$(p).find('.item-price').text((cart_item.price*v).toFixed(settings.numberPrecision));
//update total counters
countCartTotal();
}
Мне нужно увеличить "v" (cart_item.quantity) более чем на единицу. Здесь используется "v++"... но оно увеличивается только на 1. Как я могу изменить это, чтобы оно увеличивалось на 4 каждый раз, когда я нажимаю значок "плюс"?
Я пытался
v++ +4
Но это не работает.
Спасибо!