Jump to content
chasethemetal

iFrame targeting

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!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...