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

126
Views
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
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!