How to move an iframe along the DOM without losing its contents?

Is it possible?

I tried moving it, but the contents of the iframe disappear.

I tried to get the contents of the iframe and put them in a new place, but all ofc handlers disappear.

Tried to do the same, but with the new jQuery 1.4.2 function, which also clones all events.

But this does not work :)

So I decided to ask for help.

How to transfer a damned iframe to another place in the document without losing its contents? ^ _ ^

thank

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')); 

Here I am trying to copy content into a new ad container. But that will not work. The context banner does not respond to the click event.

I tried moving ad_container to the container, but the contents of the iframe body disappear.

+6
javascript dom iframe
May 21 '10 at 20:55
source share
1 answer

I believe that the elements in the iframe are not connected, unless explicitly stated in this iframe. in other words, the contents of the iframe do not inherit the binding events from the parent window. you will have to snap first in the iframe and then move things around.

I think.

EDIT

I think you can do something like

 its_body = its_contents.find("div:first").clone(true); $(its_body).insertAfter(cthis.find('#photos')); 
+1
May 21 '10 at 9:37 p.m.
source share



All Articles