JSFiddle - React, Tailwind, and code Playground

HTML

<input>

JavaScript

$.fn.disallowChars = function(regexp){
  return this.on('input', function(){
      this.value = this.value.replace(regexp, '');          
  });
};

$("input").disallowChars(/\D/g);