showing results for - "javascript play pause button"
Max
12 Nov 2018
1var button = document.getElementById("button");
2var audio = document.getElementById("player");
3
4button.addEventListener("click", function(){
5  if(audio.paused){
6    audio.play();
7    button.innerHTML = "Pause";
8  } else {
9    audio.pause();
10    button.innerHTML = "Play";
11  }
12});