Javascript to play the sound for the button code example
Example: javascript play sound onclick
var audio = new Audio("soundfile.wav");
document.onclick = function() {
audio.play();
}
var audio = new Audio("soundfile.wav");
document.onclick = function() {
audio.play();
}