jQuery wrapAll() method
Example
in
Wrap all elements in a
HTML element
jQuery object
DOM element
|
element:
$
(
"
button
"
)
.
click
(
function
(
)
{
$
(
"
p
"
)
.
wrapAll
(
"
"
)
;
}
)
;
Try it »
Definition and Usage
The wrapAll() method wraps all selected elements with the specified HTML element.
Syntax
$(
selector
).wrapAll(
wrappingElement
)
| Parameters | Description |
|---|---|
| wrappingElement | Required. Specifies the HTML element used to wrap the selected elements.
Possible values: |
More examples
Creating a new element via the DOM
How to use document.createElement() to create an element and wrap all selected elements with it.
jQuery HTML/CSS methods