JSFiddle - React, Tailwind, and code Playground

HTML

<p>Press a key on the keyboard in the input field to get the Unicode character code of the pressed key.</p>

<input type="text" size="40" onkeypress="myFunction(event)">

<p id="demo"></p>
<p id="alert"></p>

JavaScript

myFunction = function(event) {
    var x = event.which || event.keyCode;
    document.getElementById("demo").innerHTML = "The Unicode value is: " + x;
    if(x.toString().match(/^(60|62|35)$/)){
    	 document.getElementById("alert").innerHTML = "This is unsafe character";
    }else {
    	document.getElementById("alert").innerHTML = "";
    }
}