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

127
Vistas
Javascript Delete dynamically created iframe element by class?

I'm looking at winbox.js https://nextapps-de.github.io/winbox/ to create some windows. I'm using the iframe feature to load some external content. When its loaded I want to remove a specific element from the loaded page.

This is the code I'm using to create the iframe and attempt to delete the element.

"iframe": function(){

      new WinBox("Groups", {

      url: "/localwebpage",
      class: "iframe"
    });
                    
    console.log ( document.getElementById('winbox-1').contentWindow.document )
    document.getElementById('winbox-1').contentWindow.document.getElementById('toTop');

 },

When this is run the iframe opens loading the correct page, however I get:

Uncaught TypeError: Cannot read properties of undefined (reading 'document')
    at Object.iframe ((index):714)
    at HTMLDivElement.onclick ((index):314)

Line 714 is the console.log line.

This is the HTML, winbox-1 is the iframe and toTop is the element I want to remove.

HTML

How can I do this using plain javascript ?

Thanks

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