Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

168
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda