JSFiddle - React, Tailwind, and code Playground

by alexdickson

HTML

<input type="text" />

JavaScript

$('input').keydown(function(){
   var self = $(this);
    
   var removedText = self.val().replace(/\D/, '');
    
   self.val(removedText);
});