I have several HTML code combinations like this:
<h2></h2>
<p></p>
<iframe></iframe>
<hr/>
and from that I want to create such a code with jQuery:
<div id="sample">
<h2></h2>
<p></p>
<iframe></iframe>
</div>
<hr/>
I could just perform these functions:
$('h2').before('<div id="sample">');
$('iframe').after('</div>')
but these functions doesn't insert only given text, it creats new div sections. I need to put particular parts of HTML into one div section with a help of jQuery because my page contains many of these combinations.