JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<input type="number" step="1" maxlength="3"/>
<input type="button" value="fixmax"/>
JavaScript
function fixMaxlength(inputNumber) {
var maxlength = $(inputNumber).attr("maxlength");
$(inputNumber).keyup(function (evt) {
this.value = this.value.substring(0, maxlength);
this.value = this.value.replace(/\D/g, '');
});
}
$("input[type=button]").click(function() {fixMaxlength("input[type=number]")});