JSFiddle - React, Tailwind, and code Playground

HTML

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

JavaScript

$("#txtQty").keyup(function() {
    var $this = $(this);
    $this.val($this.val().replace(/[^\d.]/g, ''));        
});