HTML:
<h2></h2> <p></p> <iframe></iframe> <hr/>
jQuery:
<div id="sample"> <h2></h2> <p></p> <iframe></iframe> </div> <hr/>
:
$('h2').before('<div id="sample">'); $('iframe').after('</div>')
, div. HTML div jQuery, .
$('h2').nextUntil('hr').andSelf().wrap('<div class="sample">');
nextUntil , , , wrapAll , . andSelf , h2 :
nextUntil
wrapAll
andSelf
h2
β$("h2").nextUntil("hr").andSelf().wrapAll("<div id='sample'>");βββββββββββββββββββββββββββββββ