JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" name="phone" id="phone"  /><br />
<input type="text" name="name" id="name"  />

JavaScript

$("phone").keyup(function() {
    if (this.value.match(/[^0-9]/g)) {
                this.value = this.value.replace(/[^0-9]/g, '');
            }
});

$("name").keyup(function() {
     if (this.value.match(/[^a-zA-Z]/g)) {
                this.value = this.value.replace(/[^a-zA-Z]/g, '');
            }
});