JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="number" id="NUMBER">

JavaScript

$("#NUMBER").keydown(function (e) {
            return( Boolean(String.fromCharCode(e.keyCode).match(/[0-9]+/g)) );
        });