jquery element click event only allowed once? confuddled
- by claw
One a click event of an element, it only works once. Say the value is 2 it will increase/decrease/reset only once.
How to I reset the event so the user can keep clicking on the element increasing the value of the value .item-selection-amount
$('.item-selection-amount').click(function(event) {
var amount = $(this).val();
switch (event.which) {
case 1:
//set new value +
$(this).val(amount + 1);
break;
case 2:
//set new value reset
$(this).val(0);
break;
case 3:
//set new value -
if(amount > 0){
$(this).val(amount - 1);
}
break;
}
});
Thanks