JSFiddle - React, Tailwind, and code Playground
HTML
<div id="error1" style="width:300px;background:#FF9999;border:1px solid #FF1919;height:18px;text-align:center;font-family:Verdana;font-size:10px;line-height:18px;display:none;"> ERROR : Special Characters not allowed </div><br>
<input type='text' name='customerName' style='width:400px;text-transform:uppercase' onkeypress="return IsAlphaNumeric(event);"/>
JavaScript
window.IsAlphaNumeric = function(e) {
var result = /[0-9]/g.test(String.fromCharCode(e.charCode));
document.getElementById("error1").style.display = result ? "none" : "inline";
return result;
};