JSFiddle - React, Tailwind, and code Playground
by TJ VanToll
HTML
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<p>Type value outside min-max range 0-10 and press Tab</p>
<input id="spinner" value="5">
<input id="another_input">
JavaScript
$('#spinner').spinner({
'min' : 0,
'max' : 10,
change: function() {
var element = $( this ),
min = element.spinner( "option", "min" ),
max = element.spinner( "option", "max" ),
value = element.spinner( "value" );
if ( value < min ) {
element.spinner( "value", min );
}
if ( value > max ) {
element.spinner( "value", max );
}
}
});