Vinai Raj Vinai Raj - 2 years ago 438
jQuery Question

Identify the Click Event in bootstrap touch spin

I am little bit confusion to find the click event in the class using jquery.
my question is how to identify whether I click touchspin down or up
I am using bootstrap touch spin.

<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>

I Want to calculate some process in when Up botton clicked and some process in down button click.

Here I try to Identify the button using class.

$('.btn, .btn-default, .bootstrap-touchspin-down').click(function(){

Please help me to do this task.

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

  if ($this.hasClass('bootstrap-touchspin-down')) {
  } else if ($this.hasClass('bootstrap-touchspin-up')) {


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

$('.bootstrap-touchspin-up').click(function(event) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download