ExampleWrap a div element around all p elements:
Try it yourself » |
The wrapAll() method wraps specified HTML element(s) around all selected elements.
$(selector).wrapAll(wrappingElement) |
Parameter | Description |
---|---|
wrappingElement | Required. Specifies what HTML element(s) to wrap around the selected elements. Possible values:
|
![]() |
Try it Yourself - Examples |
Wrap using a DOM method to create a new element
How to use document.createElement(), to create an element to wrap around all selected elements.