How to get elements of Iframe
- Previous Page Get Current Screen Size
- Next Page Two-column Layout
Use JavaScript to get elements from the iframe.
Clicking this button will hide the eighth H2 element in the iframe (another document).
Get elements within the iframe
Get the first <h1> element inside the iframe and hide it:
Example
var iframe = document.getElementById("myFrame"); var elmnt = iframe.contentWindow.document.getElementsByTagName("H2")[7]; elmnt.style.display = "none";
- Previous Page Get Current Screen Size
- Next Page Two-column Layout