'How do I make a song play when I click a button?
I currently have some code where a song plays with the controls but I want to make a button that matches the theme of the website is this possible or no?
Here is my code
<audio controls autoplay loop>
<source src="Main Theme.mp3" type="audio/ogg">
<embed src="Main Theme.mp3" autostart="true" loop="true" hidden="true">
</audio>
Solution 1:[1]
Create a button and add an action to this button. The action could be javascript inside of a tag, which finds the audio and plays it.
This should solve your problem: Javascript Audio Play on click
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GetMyIsland |
