xxxxxxxxxx
//records the keys into console from input element
$('input').keypress(function(event){
console.log(event.key)
});
xxxxxxxxxx
let msg = document.getDocumentById('#message');
msg.addEventListener("keydown", (event) => {
// handle keydown
});
msg.addEventListener("keypress", (event) => {
// handle keypress
});
msg.addEventListener("keyup", (event) => {
// handle keyup
});