JSFiddle - React, Tailwind, and code Playground

by Evan Sharp

HTML

<input />
<input />

JavaScript

$("input").on("keypress keyup blur", function (event) {
    var aa = $(this).val($(this).val().replace(/[^\d\-].+/, ""));
    if ((event.which < 48 || event.which > 57)) {
        event.preventDefault();
    }
});