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

156
Vistas
Cannot read properties of undefined (reading 'destroy')

How is this fixed in the code? https://jsfiddle.net/a6dp1soy/

To reproduce error, click on the X Button

First click on the play svg, then the X button.

  const resetVideos = document.querySelectorAll(".exit");
  resetVideos.forEach(function resetVideoHandler(video) {
    video.addEventListener("click", function resetVideoHandler() {
      video.parentElement.player.destroy();
      console.log("hit")
    });
  })
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

One solution could be just replacing

video.parentElement.player.destroy();

with

video.parentElement.parentElement.removeChild(video.parentElement);

I took reference from here How to remove the parent element using plain Javascript and video.parentElement object

And then next part shall be creating that element again on clicking play

about 4 years ago · Juan Pablo Isaza Denunciar

0

You should find the element with class wrap where your player is stored on creation.

  const resetVideos = document.querySelectorAll(".exit");
  resetVideos.forEach(function resetVideoHandler(video) {
    video.addEventListener("click", function resetVideoHandler() {
      var player = this.parentElement.getElementsByClassName('wrap')[0].player;
      player.destroy();
      console.log("hit")
    });
  });

JS fiddle: https://jsfiddle.net/c54b0faw/

about 4 years ago · Juan Pablo Isaza Denunciar
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