JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" class="commonNumber" />
JavaScript
$('.commonNumber').keypress(function(event) {
var charCode = event.which;
console.log(event.which);
if ((charCode >= 32) && ((charCode < 48) || (charCode > 57))) {
event.preventDefault();
}
});