Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript play pause button

var button = document.getElementById("button");
var audio = document.getElementById("player");

button.addEventListener("click", function(){
  if(audio.paused){
    audio.play();
    button.innerHTML = "Pause";
  } else {
    audio.pause();
    button.innerHTML = "Play";
  }
});
Source by jsfiddle.net #
 
PREVIOUS NEXT
Tagged: #javascript #play #pause #button
ADD COMMENT
Topic
Name
3+4 =