$(".btn").click(function(event){
playSound(event.target.id);
});
function playSound(name){
$("." + name).click(function() {
new Audio("sounds/" + name + ".mp3").play();
});
}
The function is being called, but the audio doesn't play for the first 3 or 4 clicks. From the 4th or 5th click onwards, it functions correctly. This issue occurs in both Brave and Chrome browsers. What could be causing this problem?