JSFiddle - React, Tailwind, and code Playground

by Fernando Santos

HTML

<input type="text" onkeydown="removeSpecials(this)"/>

JavaScript

var patt = /^[a-zA-Z]*$/;
patt.test("The best things in life are free!");

var currentInputValue = "";
function removeSpecial(e) {
    var patt = /^[a-zA-Z]*$/;
    if(patt.test(element.value)) {
      currentInputValue = element.value;
    }
}