JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
$('input').keydown(function(){
var self = $(this);
var removedText = self.val().replace(/[a-zA-Z]+/, '');
self.val(removedText);
});
<input type="text" />
$('input').keydown(function(){
var self = $(this);
var removedText = self.val().replace(/[a-zA-Z]+/, '');
self.val(removedText);
});