jQuery addClass example
Change class name on click in jQuery
by Premchand R
HTML
<input type="number" value="1">
JavaScript
$('input').on('input', function () {
var value = $(this).val();
if ((value !== '') && (value.indexOf('.') === -1)) {
if(value > 0)
$(this).val(Math.max(Math.min(value, 100), -100));
else if(value == 0)
$(this).val(Math.max(value, 1));
}
});