jQuery wrapAll()Method
Example
Wrap all <p> elements inside a <div> element:
$("button").click(function(){
$("p").wrapAll("<div></div>");
});
Try it Yourself »
Definition and Usage
The wrapAll() method wraps all selected elements with the specified HTML element.
Syntax
$(selector).wrapAll(wrappingElement)
| Parameter | Description |
|---|---|
| wrappingElement | Required. Specifies the HTML element to wrap around the selected elements. Possible values:
|
More Examples
Create new elements using the DOM
How to use document.createElement() to create an element and use it to wrap all selected elements.
Other Extensions
jQuery HTML/CSS Methods