Description
The .wrapInner() method wraps specified HTML element(s) around the content (innerHTML) of each selected element.
v1.2
This method has the form:
.wrapInner(wrappingElement)
Parameter | Description |
---|---|
wrappingElement | (required) Specifies what HTML element(s) to wrap around the content of each selected element.
Possible values:
|
Return Value
This form returns a jQuery object.
Wrap Content Using a Function
Using a function to specify what to wrap around the content of each selected element.
v1.4
This method has the alternate form:
.wrapInner(function())
Parameter | Description |
---|---|
function() | (required) Specifies a function that returns the wrapping element |
Return Value
This form returns a jQuery object.
Examples
Wrap a b element around the content of each p element:
$("button").click(function(){
$("p").wrapInner("<b></b>");
});