JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<input type="number" value="5" />
JavaScript
$('input[type="number"]').change(function () {
if (this.getAttribute('value') === this.value) {
// setting the original 'lastvalue' data property
$(this).data('lastvalue', this.value);
} else {
console.log(this.value < $(this).data('lastvalue') ? 'decrement' : 'increment');
$(this).data('lastvalue', this.value);
}
}).change();