$(this).keypress((e) => { if (e.key === "a") alert("you pressed a"); else alert("you pressed " + e.key); });