How to listen for step up event for input type = "number"
There are no recent events for upand down. You can use eventchange
$(".counter").change(function () {
alert($(this).val());
})
You can try something like: you can save the previous value and compare with the current value and identify up or down
$(".counter").change(function () {
if ($(this).data('old-value') < $(this).val()) {
alert('Alert up');
} else {
alert('Alert dowm');
}
$(this).data('old-value', $(this).val());
})
You must do this:
var $counter = $("your_counter");
var number = $counter.val();
$counter.change(function () {
if($counter.val() > number)
alert('up');
else
alert('down');
number = $counter.val();
});
Here is a demo: http://jsfiddle.net/6bb8S/
