JSFiddle - React, Tailwind, and code Playground

HTML

<label>Digits Only:
  <input type="number" name="test" min=0 save="" oninput="validity.valid ? this.save = value : value = this.save;">
</label>
<br>
<br>

JavaScript

$(function() {
  $('input').bind('keyup', function(event) {
    var v = $(this).val();
    $(this).focus().val("").val(v);
    var currValue = $(this).val();
    $(this).val(currValue.replace(/[^0-9]/, ''));
    alert(v);
  });
});