JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id='my_text'>
CSS
#my_text {
border: 1px solid black;
}
JavaScript
(function(){
var text = document.getElementById("my_text"),
testText;
text.onkeyup = function testKey(){
var testText = text.value;
if(testText*1 + 0 != text.value){
text.value = testText.substring(0, testText.length - 1)
}
}
})()