JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" class="lettersonly">

JavaScript

$(function() {
    $('.lettersonly').keyup(function() {
        this.value = this.value.toUpperCase();
    });
});

$(".lettersonly").on("input", function(){
  var regexp = /[^a-zA-Z]/g;
  if($(this).val().match(regexp)){
    $(this).val( $(this).val().replace(regexp,'') );
  }
});