JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="id_del_campo"/>
JavaScript
var input = document.getElementById('id_del_campo');
input.addEventListener('textInput', function(e) {
//Capturamos los datos
const caracter = e.data;
const caracterKey = caracter.charCodeAt(0);//Ehemplo a = 97
if (caracterKey === 97) {
console.log("Se escribio la A")
//e.preventDefault();
return false;
}
return true;
});