Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

171
Views
How to remove an audio function within an event listener?

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!

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!