Working jQuery, what I'd like to perform is something similar to the following:
$('sometag').children().wrap('<div></div>');
With the resulting DOM manipulation wrapping all children in one div, not each child individually.
Starting example HTML:
<div>
<h3>Heading</h3>
<p>Paragraph</p>
</div>
What this line of code does:
<div>
开发者_开发问答 <div>
<h3>Heading</h3>
</div>
<div>
<p>Paragraph</p>
</div>
</div>
What I want:
<div>
<div>
<h3>Heading</h3>
<p>Paragraph</p>
</div>
</div>
What is the proper syntax to achieve the end result I'm looking for?
$('sometag').children().wrapAll("<div></div>");
$('tag').wrapInner('<div>');
$('sometag').html('<div>' + $('sometag').html() + '</div>');
精彩评论