Wrapping Elements in jQuery
Tags can be wrapped in other tags, for example, if we have paragraphs, we can additionally wrap them in div tags. For such things, the wrap method is used, which allows you to wrap each found element in the specified tag.
For example, let's say we have paragraphs with class www:
<p class="www">text</p>
<p class="www">text</p>
<p class="www">text</p>
<p>text</p>
Let's wrap them in the div tag:
$('.www').wrap('<div>');
HTML the code will look like this:
<div><p class="www">text</p></div>
<div><p class="www">text</p></div>
<div><p class="www">text</p></div>
<p>text</p>
Wrap each h3 in div.