jQuery wrapAll () method
Examples
All wrapped in <p> elements in the <div> element:
$("button").click(function(){
$("p").wrapAll("<div></div>");
});
$("p").wrapAll("<div></div>");
});
try it"
Definition and Usage
wrapAll () method using the specified HTML element to wrap all selected elements.
grammar
$(selector).wrapAll(wrappingElement)
参数 | 描述 |
---|---|
wrappingElement | 必需。规定包裹被选元素的 HTML 元素。 可能的值:
|
More examples
Create new elements by DOM
How to use document.createElement () to create the element, and use it to wrap all selected elements.