Skip to main content
DevTools24

KeyCode検索ツール

任意のキーを押して、key、code、keyCode、修飾キー状態を含むJavaScriptイベントプロパティを確認。

Press any key to see its codes

Click anywhere on the page and press a key

Note: keyCode and which are deprecated. Use key for character and code for physical key.

Keyboard Events - 技術的な詳細

Modern browsers use event.key (character) and event.code (physical key). The legacy keyCode property is deprecated but still widely used for compatibility.

コマンドラインでの代替方法

// JavaScript keyboard event listener
document.addEventListener('keydown', (e) => {
  console.log('key:', e.key);
  console.log('code:', e.code);
  console.log('keyCode:', e.keyCode);
});

参照

公式仕様を見る