How to play sound on click without waiting for the previous sound to finish playing? Spamming the button = Spamming the sound file?

I got a sound on click, on a button. But I can’t rapidly spam the button to hear that sound over and over again, instead I have to wait until the sound is over to play it again. How can I let the sound, when playing, get interrupted by a new click, playing the sound from the start?

  function play(){
       var audio = document.getElementById("audio");;

<button onclick="play()">
     <audio id="audio" src="bell.ogg" ></audio> </button>

Hi there StupidQuestionsNeed,

and a warm welcome to these forums. :winky:

Check out this attachment, (571.5 KB)

… to see hear a possible method :wonky:


1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.