Flowing content in a div using javascript without updating iframe

Basically, I want to wrap some content on my page in a div.

I can do this using the wrap function in jQuery, but my problem is that I have several frames in my content that contain ads, and when you finish the content, it updates iframes.

From what I can say, this is because behind the scenes he clones the contents to be wrapped in a new div.

HTML

<div class="content">
   <iframe src="http://something.com/ads"></iframe>
</div>

Js

$(content).wrap('awesome_container');

Ideally, I would just like to put some open div tags in front of the contents of the div and a few tags next to the div tag, but I cannot add any divs to the page without adding close tags.

Does anyone know about this issue?

Greetings

+5
source share
2 answers

, html , , jQuery detach() , , . iFrame, .

var orphan = $(selector).detach()
someParent.html(orphan);

, :)

+2

, wrap html , - iframe. append, iframe, . contianer, content div .

$('.content').before("<div id='awesome_container' />");

$('#awesome_container').append($('.content'));
0

All Articles