Javascript 识别引导触摸旋转中的点击事件

Javascript 识别引导触摸旋转中的点击事件,javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,我对使用jquery在类中找到click事件感到有点困惑。 我的问题是如何识别我是向下还是向上单击触针 我正在使用引导触摸旋转 <button type="button" class="btn btn-default bootstrap-touchspin-down">-</button> <input type="number" value="18" onchange="calculatetotal(3)" style="width: 100%; padding:

我对使用jquery在类中找到click事件感到有点困惑。 我的问题是如何识别我是向下还是向上单击触针 我正在使用引导触摸旋转

<button type="button" class="btn btn-default bootstrap-touchspin-down">-</button>
<input type="number" value="18" onchange="calculatetotal(3)" style="width: 100%; padding: 0px; display: block;" class="ex_limit form-control" readonly="" id="qty3">
<button type="button" class="btn btn-default bootstrap-touchspin-up">+</button>
请帮我做这个任务

$('[class*="bootstrap-touchspin-"]').click(function(event) {
  var $this = $(this);

  if ($this.hasClass('bootstrap-touchspin-down')) {
    alert('down');
  } else if ($this.hasClass('bootstrap-touchspin-up')) {
    alert('up');
  }
});
或者:

$('.bootstrap-touchspin-down').click(function(event) {
  alert('down');
});

$('.bootstrap-touchspin-up').click(function(event) {
  alert('up');
});

更好、更简单的方法是处理如下所示的更改事件

  $('input[name=\'cart-quantity\']').on("change",function(event){
    alert("hi")
})

只需使用
$('.bootstrap touchspin down')。单击(function(){…})
相反,逗号分隔的列表表示多个元素谢谢亲爱的我找到了@Darren Sweeney
  $('input[name=\'cart-quantity\']').on("change",function(event){
    alert("hi")
})