I have downloaded a HTML5 audio player source from here
and I want to change the way the player is controlled from clicking to key pressing.
In js file I found this:
// play click
$('.play').click(function (e) {
e.preventDefault();
playAudio();
});
and I tried to implement this but didn't work:
document.onkeydown = function(e) {
if (e.keyCode == 78) {
e.preventDefault();
playAudio();
}};
How can I get this to work?