Question : play audio on button click html
Answered by : successful-sandpiper-zknwjxkunfm5
var sound = new Audio("file.wav");
button.addEventListener('click',()=>{ sound.currentTime = 0; sound.play();
});
Source : | Last Update : Thu, 12 Aug 21
Question : click button play sound html
Answered by : diamond-dirt
<audio id="testsound" src="test.mp3" preload="auto"></audio> <button onclick="document.getElementById('testsound').play();">Play Sound</button>
Source : | Last Update : Mon, 10 Oct 22