JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" pattern="[0-9]+" />

JavaScript

$('input').on('keydown', function (e) {
        console.log(e.which);
        var dot = $(this).val().indexOf('.');
        if ((e.which >= 48 && e.which <= 57) || (e.which >= 96 && e.which <= 105) || ((e.which == 190 || e.which == 110) && dot == -1)) return true;
        return false;
    });