JSFiddle - React, Tailwind, and code Playground

HTML

<input id="myText" type="text"/>

JavaScript

$("#myText").keyup(function(e) {
  var previousKey = this.value.substring(this.value.length-2,this.value.length-1);
  //check if previous key is a space, or for the first letter and if it is a valid letter
  if ((previousKey == " " || this.value.length == 1) && (e.which >= 65 && e.which <= 90)) {
      var newVal = this.value.substring(0, this.value.length-1);        
      this.value =newVal + String.fromCharCode(e.keyCode);
  }
});