---
title: "Discussion on \"Javascript - Event on Pressing Keyboard\" | Hashnode"
description: "Discussion on \"Javascript - Event on Pressing Keyboard\". Simple way to detect keyboard pressed is by injecting event listerner, in this case we will detect escape key.\n// Add the event listener when needed.\ndocument.addEventListener('keydown', OnKeyboardPressed);\n\nconst escPressed = () => { \n  // Remove ev..."
url: "https://hashnode.com/posts/javascript-event-on-pressing-keyboard/6674e87fbd47a7b72c3fbad1"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Javascript - Event on Pressing Keyboard](https://fiko.me/javascript-event-on-pressing-keyboard?utm_source=hashnode&utm_medium=feed)

Simple way to detect keyboard pressed is by injecting event listerner, in this case we will detect escape key. // Add the event listener when needed. document.addEventListener('keydown', OnKeyboardPressed); const escPressed = () => { // Remove ev...

Jun 21, 2024 · 1 min read · fiko.me  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Fiko Borizqy](https://hashnode.com/@fikoborizqy)

@fikoborizqy · Yogyakarta, Indonesia

  
[View profile](https://hashnode.com/@fikoborizqy)

Magento 2 Developer

I wrote these tutorials for myself in future when I forget for the next steps.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
