keypress escape code example
Example: javascript detect escape key
document.addEventListener('keydown', function(event){
if(event.key === "Escape"){
//do something
}
});
document.addEventListener('keydown', function(event){
if(event.key === "Escape"){
//do something
}
});