play sound with keydown javascript

Solutions on MaxInterview for play sound with keydown javascript by the best coders in the world

showing results for - "play sound with keydown javascript"
Felix
28 Apr 2018
1document.addEventListener('keydown', function(e) {
2  if (e.keyCode == 65) {
3    document.getElementById('audio').play();
4  }
5});
Zuriel
31 Feb 2016
1<audio id="audio" controls style="display:none">
2  <source src="http://butlerccwebdev.net/support/html5-video/media/soundfile.mp3" type="audio/mpeg"> Your browser does not support the audio element.
3</audio>