How to move iframe along the DOM without losing it's content?

Posted by Beck on Stack Overflow See other posts from Stack Overflow or by Beck
Published on 2010-05-21T20:55:04Z Indexed on 2010/05/21 21:30 UTC
Read the original article Hit count: 167

Filed under:
|
|

Is it possible?

I have tried to move it, but iframe contents dissapear.

Tried to get contents of iframe and place them in the new place but all handlers ofc dissapear.

Tried to do the same, but with new jQuery 1.4.2 feature, that clones all events along with it.

But it doesn't work :)

So I have decided to ask here for help.

How to move the damn iframe to another place in the document without losing it's contents? ^_^

Thanks

Added:

txtad_iframe = ad_container.find('iframe');                 
its_contents = txtad_iframe.contents();
its_body = its_contents.find("div:first").clone(true).insertAfter(cthis.find('#photos'));
new_ad.append(its_body);

Here i'm trying to copy contents to new ad container. But it doesn't work. Context banner doesn't react on click event.

I have tried to move ad_container to container, but iframe body content dissapears.

© Stack Overflow or respective owner

Related posts about iframe

Related posts about JavaScript