JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<input id='foo' type='text'></input>
</body>
JavaScript
$('#foo').keydown(function(e) {
var code = e.which;
if (code == 8 || code == 13) return true; // backspace and enter
if (code < 48 || code > 57 || code == 188 || code == 190) return false;
});