The following web example consists of 3 divs with id content each. The scripts executed, using the wrapAll() and wrapInner() functions, will be the following:
xxxxxxxxxx
<div id="content">Content 1</div>
<div id="content">Content 2</div>
<div id="content">Content 3</div>
<!--Script jQuery-->
<script>
//We select all the div with id content and place a div with id content_external that wraps them all
$("div#content").wrapAll('<div class="content_external">External Content</div>');
//We select all the div with id content and we place in its interior a div with id content_inner
$('div#content').wrapInner('<div class="content_inner">Inner Content </div>');
</script>
<!--JQuery Library-->
<script src="https://code.jquery.com/jquery-3.6.3.min.js"></script>
Interesting Articles