JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<input id='foo' type='text'></input>
</body>
JavaScript
$('#foo').keypress(function(event) {
var code = window.event ? event.keyCode : event.which;
var chr = String.fromCharCode(code);
if ("0123456789.,".indexOf(chr) < 0)
return false;
});