I need to increase value, by clicking plus or minus picture. It works fine when it’s only one “item_quantity” block at the page. But it works incorrectly if I wanna add another “item_quantity” block.
JS code that increase value:
$('.item_quantity .plus').click(function() { var num = parseInt($('.item_quantity .quan_numb').text()); $('.item_quantity .quan_numb').text(num + 1); });
http://codepen.io/Vlasov/pen/dvogmp?editors=1010
Answer
$(this).parent().find('.quan_numb')
http://codepen.io/anon/pen/ZeGqmd?editors=1010