JSFiddle - React, Tailwind, and code Playground

by Mark Coleman

HTML

<input type="text" class="numerals_only"/>

JavaScript

$('input.numerals_only').keyup(AllowOnlyNumber).blur(AllowOnlyNumber);

function AllowOnlyNumber()
{
    var v = $(this).val();
    var no_nonnumerals = v.replace(/[^0-9]/g, '');
    $(this).val(no_nonnumerals); 
}