JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
$(function() {
$("input").keyup(function() {
this.value = this.value.match(/[-+]?[0-9]*\.?[0-9]*/);
});
});
<input type="text" />
$(function() {
$("input").keyup(function() {
this.value = this.value.match(/[-+]?[0-9]*\.?[0-9]*/);
});
});