Jump to content

iFrame targeting


chasethemetal

Recommended Posts

Hello! I have 2 pages, the parent document and mulitple iframes in that parent document. In the iFrames I am trying to target it's own class attribute... <iframe class="frame"></iframe><iframe class="frame"></iframe><iframe class="frame"></iframe> So inside each iframe I have a function and I am trying to clear its class! But I can't figure out how to target itself!!! So I do the function in the first <iframe> and it should look like this now <iframe></iframe><iframe class="frame"></iframe><iframe class="frame"></iframe> Any help would be appricieated thanks!

Link to comment
Share on other sites

The document inside the iframe doesn't have direct access to the iframe element in the parent document. You need to navigate through the DOM to the parent document's DOM and access the iframe object in that. I believe window.parent will give you a reference to the parent DOM.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...