jQuery .wrap()

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

js:


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

html:


Before script:

<div class="target">.target</div>





After script:

<div class="wrapper"><div class="target">.target</div></div>

Leave a Comment