New course! Every coder should learn Generative AI!
Try a free lesson- 1
How to create onclick music ?
I want to make a webpage in which if I click on screen the audio starts playing automatically however, the audio control should not be visible. Can you tell the code ?
3 Answers
+ 14
Here's the example. I used a button. You can try using body instead.
https://code.sololearn.com/WYQWv9z9cndF/?ref=app
+ 14
https://code.sololearn.com/WxPVZz819g1O/?ref=app
0
You are not forced to add controls attribute for the audio. Add the onclick event to the body tag. You can use the play fumction [.play()] to play the song; that's so easy