jQuery .wrap()

jQuery .wrap() wraps an HTML structure around each element in the set of matched elements.

$('.target').wrap( '<div class="wrapper"></div>' );
Before script:
<div class="target">.target</div>
 
 
After script:
<div class="wrapper"><div class="target">.target</div></div>

Leave a Reply

Your email address will not be published. Required fields are marked *