JavaScript: Access element in iframe ‘A’ from iframe ‘B’

So, I’ve got an iframe called “mainiframe” and I want to access an element in “subiframe”. As long as the “subiframe” has its name set to “subiframe”, all I have to do to find the element ‘test’ is: –

var el = parent.subiframe.document.getElementById("test");



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: