0 votes
in JavaScript by
How do you invoke javascript code in an iframe from parent page?

1 Answer

0 votes
by

Initially iFrame needs to be accessed using either document.getElementBy or window.frames. After that contentWindow property of iFrame gives the access for targetFunction

document.getElementById("targetFrame").contentWindow.targetFunction();
window.frames[0].frameElement.contentWindow.targetFunction(); // Accessing iframe this

Related questions

0 votes
asked Oct 25, 2023 in JavaScript by DavidAnderson
0 votes
asked Oct 21, 2023 in JavaScript by DavidAnderson
...