I'm making a personal project based on selecting a random artist with a song attached to it. The thing is that I need to remove the "captionAudio(selected_image)" function so it can stop playing the song.
btn.addEventListener("click", function(event) {
const random_index = Math.floor(Math.random()*imageList.length);
const selected_image = imageList[random_index];
modal.classList.add("open");
popImage.classList.add("open");
popImage.src = selected_image;
caption.textContent = captionText(selected_image);
playSound();
captionAudio(selected_image);
});
modal.addEventListener("click",(e)=>{
if(e.target.classList.contains("modal")){
modal.classList.remove("open");
popImage.classList.remove("open");
}
});
if you need the entire code I used for the whole page, let me know!