Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda