keecode logokeecode

d

68

d

event.keyCode

68

event.key

d

event.code

KeyD

Unicode

n/a

Code Examples

Copy and paste these examples to detect the d key in your JavaScript code

Recommended modern approach

// Modern approach (recommended)
document.addEventListener('keydown', (e) => {
  if (e.key === 'd') {
    console.log('d key pressed!');
    // Your code here
  }
});

Related Keys

Other keys commonly used together or in similar contexts