Visitar URL original
logging key pressed · wesbos/JavaScript30@4a21f02 · GitHub
Skip to content

Commit 4a21f02

Browse files
Razvan HoreangaRazvan Horeanga
authored andcommitted
logging key pressed
1 parent 61b13da commit 4a21f02

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎01 - JavaScript Drum Kit/index-START.html‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
<audio data-key="76" src="sounds/tink.wav"></audio>
5959

6060
<script>
61-
61+
window.addEventListener('keydown', function(e){
62+
const audio = document.querySelector("audio[data-key='"+e.keyCode+"']");
63+
console.log(audio);
64+
});
6265
</script>
6366

6467

0 commit comments

Comments
 (0)