JSFiddle - React, Tailwind, and code Playground
HTML
<input type="number" min="1" max="1000" id="num" step="false" novalidate/>
JavaScript
$("#num").on("keyup change focusin focusout", function (e) {
//e.preventDefault();
$(this).attr("step", getStep($(this).val()));
});
function getStep (val) {
val = parseFloat(val);
var step = 1;
if (val < 5) {
console.log('here');
step = 2;
} else if (val < 10) {
step = 5;
}
return step;
}