Answers for "print js iframe"

7

how to get element in iframe using javascript

const iframe = document.getElementById("myIframe");

const iWindow = iframe.contentWindow;
const iDocument = iWindow.document;

// accessing the element
const element = iDocument.getElementsByTagName("p")[0];
element.style.color = "green";
Posted by: Guest on October-21-2021
1

iframe with html string

<iframe srcdoc="<html><body>Hello, <b>world</b>.</body></html>"></iframe>
Posted by: Guest on August-16-2020

Browse Popular Code Answers by Language