Just updated my code, please take a look!
I have created a button using HTML, CSS, and JavaScript and I am trying to figure out how to hide it once it's clicked.
Below is the HTML for the button that should play music when clicked:
<audio id="mySong" src="http://www.rachelgallen.com/HappyBirthday.mp3"></audio>
<button type="button" onclick="playPause()">►</button>
CSS Styles
body { background: black; }
button {
background: rgba(255,255,255,0.8);
border: 0;
padding: 10px 25px;
border-radius: 10px;
font-size: 20px;
font-weight: bold;
box-shadow: 0 5px gray;
outline: none;
cursor: pointer;
}
button:active {
background: #DDDDDD;
color: #222222;
border-bottom: 0;
box-shadow: 0 3px #555555;
margin-top: 2px;
}
Javascript Function
function playPause() {
var audio = document.getElementById("mySong");
if (audio.paused) {
audio.play();
} else {
audio.pause();
}
}