0

Is there a way to target an HTML element that is being pulled in dynamically via an iframe. I have an example below to illustrate what I would like to do:

        <html>
          <body>
            <iframe>
              <html>
                <body>
                 <a id="id">I want to target this element</a>
                </body>
              </html>
            </iframe>
          </body>
      </html>
#id{display:none;}

Note: I am open to use javascript or similar to target this element. Accessing the content from the source is not an option.

Neel Basu
  • 12,638
  • 12
  • 82
  • 146
jeffreynolte
  • 3,749
  • 11
  • 41
  • 64
  • cant you just put `#id` css element inside frame ? – Neel Basu Aug 26 '11 at 16:27
  • 1
    See: http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe The upshot is that CSS in a page can style the border of the iframe, but does not extend to the content of the iframe because it houses a separate document with it's own separate stylesheets. – Wyatt Aug 26 '11 at 16:35
  • See this question and the approved answer: https://stackoverflow.com/a/7570527/152422 If you can access the content in the `iframe` then you're good to go to manipulate it. – fabrik Sep 21 '18 at 12:28

0 Answers0