play sound on click event using javascript





source :
<audio id="audio" src="http://www.soundjay.com/button/beep-07.wav"

autostart="false" ></audio>
    <input type="button" value="click" onclick="PlaySound()">
    <script>
    function PlaySound() {
          var sound = document.getElementById("audio");
          sound.play()
      }
    </script>

Comments