JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <input id='foo' type='text'></input>
</body>

JavaScript

$('#foo').keypress(function(evt) {
    var code = window.event ? event.keyCode : evt.which;
    var chr = String.fromCharCode(code);
    if ("0123456789.,".indexOf(chr) < 0) {
        return false;
    }
});