[英]JQuery - How to deal with field that can be updated via arrow keys?
I have just discovered a problem on my shoping cart page and am unsure of the best way to deal with this. 我刚刚在购物车页面上发现了一个问题,并且不确定处理此问题的最佳方法。
I am using Twitter Bootstrap and have been working on the quantity fields in the shopping basket. 我正在使用Twitter Bootstrap,并且一直在研究购物篮中的数量字段。 When a user increases (via click) the amount, it automatically updates the cart information. 当用户增加(通过点击)金额时,它会自动更新购物车信息。
Now while testing this I mistakenly dragged my mouse over the quantity field and I noticed that the value increases if I slide over it, or if I use the arrow keys... and obviously my current jquery function does not pick up on this: 现在,在测试时,我错误地将鼠标拖到“数量”字段上,我注意到如果在该字段上滑动或使用箭头键,该值会增加...显然我当前的jquery函数对此不起作用:
Here is the current code: 这是当前代码:
$('.product-quantity').on('click','.input-group',function(){
//Do stuff
}
So my question is this, what would be a better way to deal with the changing quantity field so that no matter what method is used to update the value, it triggers the function? 所以我的问题是,什么是处理数量变化字段的更好方法,以便无论使用哪种方法来更新值,它都会触发该函数?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.