JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" class="numeric" />
JavaScript
$('.numeric').on('input', function (event) {
this.value = this.value.replace(/[^0-9]/g, '');
});
<input type="text" class="numeric" />
$('.numeric').on('input', function (event) {
this.value = this.value.replace(/[^0-9]/g, '');
});