> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/manipulation/.wrap.md).

# .wrap()

Wraps an element with a new parent element.

```javascript
$('#avatar').wrap('div.avatar-frame');
```

outputs:

<pre class="language-html"><code class="lang-html"><strong>&#x3C;div class="avater-frame">
</strong>    &#x3C;div id="avater">...&#x3C;div/>
<strong>&#x3C;div/>
</strong></code></pre>

```javascript
$('.image*').wrap('figure.media-frame');
```

outputs:

<pre class="language-html"><code class="lang-html"><strong>&#x3C;figure class="media-frame">
</strong>    &#x3C;div class="image">...&#x3C;div/>
<strong>&#x3C;figure/>
</strong>

&#x3C;figure class="media-frame">
    &#x3C;div class="image">...&#x3C;div/>
&#x3C;figure/>

...
</code></pre>
