oninput = "value=value.replace(/[^\d]/g,'')"html
<input type="text" oninput = "value=value.replace(/[^\d]/g,'')">