JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Integer Textbox</h1>
<input type="text" autocomplete="off" id="txtIdNum" onkeypress="return AllowOnlyNumbers(event);" onpaste="return AllowOnlyNumbers(event);"/>
JavaScript
function AllowOnlyNumbers(e) {
e = (e) ? e : window.event;
var clipboardData = e.clipboardData ? e.clipboardData : window.clipboardData;
var key = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
var str = (e.type && e.type == "paste") ? clipboardData.getData('Text') : String.fromCharCode(key);
return (/^\d+$/.test(str));
}