I am working with a website that uses different iframes on the same webpage. I am wondering how I can access and manipulate an iframe that I am not currently focused in on.
The website has a body that allows users to type in, and I want to use the method innerHTML (javascript) to set the value of text in the box. However, I'm having trouble accessing the iframe.
Here is the Javascript that I was trying to use, but it wasn't working as I intended.. getElementById is not a function of getElementsByTagName("iframe")
document.getElementsByTagName("iframe")[1].getElementById("tinymce").innerHTML="Hello, world!"
Here are the two iframes that I am working with:
I cannot inspect the page and change the iframe by hand, so that is not an answer I am looking for. Thank you for clearing things up for me!
EDIT: As suggested, I try
document.getElementsByTagName("iframe")[1].document.getElementById("tinymce").innerHTML="Hello, world!"
However, I am still receiving an uncaught type error