JSFiddle - React, Tailwind, and code Playground

HTML

<input class="input-quantity" />

JavaScript

$(".input-quantity, .quantity").keypress(function (e) {			
     		if (e.which != 8 && e.which != 0 && (e.which < 49 || e.which > 57)) {
               return false;
    		}
   		});