I have a html page where when a button is clicked it opens an iframe page.
In the iframe I made a button to close it, but it doesn't work.
iframe and page are all the same site!
let closeBtn = document.querySelector ("# close_btn"); // The "cross" button in the iframe
closeBtn.onclick = function () {
write.classList.add ("write-off"); // Add the class to the main HTML page
dimming.classList.add ("write-dimming-off"); // Add the class to the main HTML page
};
It doesn't work either.
let closeBtn = document.querySelector ("# close_btn");
closeBtn.onclick = function() {
window.parent.document.querySelector(".write").classList.add("write-off");
window.parent.document.querySelector(".write-dimming").classList.add("write-off");
};