开发者

Can i clone an existing iframe and place it in another div?

If I am trying to do $($('#iframeid').clone()).appendTo('#SomeDiv') then once again an http request is sent and the newly appended iframe is now containing a fresh page rather the page with existing data开发者_如何学JAVA. Any solution? I want to copy the iframe into a specific div structure so that jquery splitter plugin can understand that .


AFAIK, the content inside the iframe doesn't get included when the browsers builds the DOM. So, clone just clones the iframe with its attributes but without the content inside. It is like copy-pasting the <iframe src="SOMEURL">. So, it sends yet another HTTP request for the requested resource.


Just try:

$('#iframeid').clone().appendTo('#SomeDiv')

You can also use

$('#iframeid').clone().insertAfter('#SomeDiv')

or

$('#iframeid').clone().insertBefore('#SomeDiv')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜