Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<div>Please press the Esc key</div>
<script>
$(document).on(
'keydown',
function(event) {
if(event.key == "Escape") {
alert('Esc key pressed.');
}
});
</script>
</body>
</html>