JSFiddle - React, Tailwind, and code Playground
by CJ Ramki
HTML
<input class="input" maxlength="1" type="text" autocomplete="off"/>
JavaScript
$('.input').keyup(function () {
if (!this.value.match(/[0-9]/)) {
this.value = this.value.replace(/[^0-9]/g, '');
}
});