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>');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With