JSFiddle - React, Tailwind, and code Playground
HTML
<input/>
JavaScript
$(function() {
$('input').blur(function() {
var value = $(this).val();
$(this).val(value.replace(/[^\d\.\-]/g, ''));
});
});
<input/>
$(function() {
$('input').blur(function() {
var value = $(this).val();
$(this).val(value.replace(/[^\d\.\-]/g, ''));
});
});