<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Keyboard Event Example</title>
</head>
<body>
<h1>Press any key</h1>
<p id="output"></p>
<script>
document.addEventListener('keydown', function(event) {
const output = document.getElementById('output');
output.textContent = `Key: ${event.key}, Code: ${event.code}`;
});
</script>
</body>
</html>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.