JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" value="0">
<div>Click me after changing the spinner</div>
CSS
div {
border: 3px red dashed;
padding: 10px;
margin-top: 20px;
display: inline;
}
JavaScript
var mymax =3
$("input").spinner({
max: mymax,
min: 0,
stop: function(){
// we have some functionality to run here
alert('run after "stop"');
}
}).blur(function () {
var value1 = $('input').val();
var max =mymax
if (value1>max) {
$('input').val(max);
}
if(isNaN(value1))
{
$('input').val(max);
}
// we have some functionality to run here
alert('run after "keypress"');
});