detect esc button clicked with javascript 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
}
});