How to increase the value of a quantity field with jQuery?

前端 未结 8 1173
北荒
北荒 2021-01-07 05:25

I have a form with some quantity field and a plus and minus sign on each side,

    
product1
8条回答
  •  余生分开走
    2021-01-07 06:09

    You should use unique id's for all your inputs, e.g. qty1_add, qty1_minus. Then you can attach the click event to these buttons:

    $("#qty1_add").click( function() {
       $("#qty1").val( parseInt($("#qty1").val()) + 1);
    }).
    

提交回复
热议问题