JSFiddle - React, Tailwind, and code Playground
by madhawa11111
HTML
<input type="text" onkeyup="checkInput(this)"/>
JavaScript
function checkInput(ob) {
var invalidChars = /[^0-9]/gi
if(invalidChars.test(ob.value)) {
ob.value = ob.value.replace(invalidChars,"");
}
}