JSFiddle - React, Tailwind, and code Playground
HTML
<form action="" id="theform">
<input type="text" id="theField" name="theField">
<button id="theBtn">Submit</button>
</form>
JavaScript
$('#theField').on('keypress input', function(){
var value = $(this).val();
value = value.replace(/\D+/, '');
$(this).val(value);
})