+ 1
Can I make sound play when element is clicked?
I want to add some sound effects to my canvas
4 Answers
+ 3
document.getElementsByTagName("canvas")[0].onclick = () => document.getElementsByTagName("audio)[0].play();
+ 2
I made this:
https://code.sololearn.com/WcjTk4KZJXjX/?ref=app
If I have done this correctly this should clone the audio, play it and then remove it.