jQuery Document Manipulation - wrapAll() Method
Example
Wrap all paragraphs inside <div>:
$(".btn1").click(function(){ $("p").wrapAll("<div></div>"); });
Definition and Usage
wrapAll() places all selected elements in the specified HTML content or element.
Syntax
$().wrapAll(wrapper)
Parameter | Description |
---|---|
wrapper |
Required. Specifies the content to wrap around the selected elements. Possible values:
Existing elements will not be moved, they will only be copied and wrapped around the selected elements. |
More examples
- Use the new element to wrap
- Create a new DOM element to wrap each selected element.