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.
How can I do this using plain javascript ?
Thanks