JSFiddle - React, Tailwind, and code Playground

by SNAG12

HTML

<input id="myInput" type="text" />

JavaScript

$("#myInput").bind('keyup', function(){
     val1 = $(this).val();
     $(this).val(val1.replace(/[^0-9.]/g,''));
});