hello everybody, trying to pass this test case#06 error for days now, but no luck, as i mentioned in topic statement, clicking on “Run Tests” from FCC widget keeps playing a sound from sound associated to “q”, each time!!
The test says, ’ When I press the trigger key associated with each .drum-pad, the audio clip contained in its child <audio> element should be triggered ’
You are doing this on click, where you are querying for the audio element identified by the clicked key id.
But on key press, you are simply creating a new audio element and taking the audio source from the list of audio files and playing it.
Inside the playSoundsOnPress(evt), apply the same code for playing the audio as you are using inside the playSoundsOnClick(evt), as below:
let audioElem = document
.querySelector(`#${key}`) <-- query by the key variable
.querySelector("audio");
it sure did help!! thanks
i wasnt aware that “key” needs to be available in “press” events!! but let me see if i can make this to work!! thanks again, much appreciated