Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
How can i access to iframe inside iframe?
<iframe src="...">
    <iframe id="embedIframe" src="...">
    </iframe>
</iframe>

I want to select an Iframe element with an Id of "embedIframe".

I tried document.getElementById("embedIframe") in the console window in developer tools.

But this returns a null value.

The strange thing is that if I directly click "embedIframe" in the Chrome Developer Tools element tab with the mouse, then return to the console window and type document.getElementById("embedIframe"), a normal value is output.

https://i.imgur.com/natyF1I.png

I'm using react.

React doesn't find document.getElementById("embedIframe") either.

How can i access to Iframe id "embedIframe" at once?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you have a document containing an iframe, and in the same document you have another iframe as a child element of the first … then your HTML is invalid and you can't do that.

Children of iframes used to be alternative content to render if the browser didn't support iframes, but that has been phased out and iframes are no longer allowed children.


If you have an iframe with a src of ... and then the document (from ...) the is loaded into that iframe contains another iframe then document.getElementById("embedIframe") doesn't work because embedIframe isn't part of that document.

You need to get the iframe in the current document, then get the document belonging to that frame, and then search that document for the iframe you want.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!