"); }); ``` "> "); }); ``` " />
Easy Tutorial
❮ Traversing Closest Traversing Has ❯

jQuery wrapInner() Method

jQuery HTML/CSS Methods

Example

Wrap the content of each <p> element with a <b> element:

$("button").click(function(){
    $("p").wrapInner("<b></b>");
});

Definition and Usage

The wrapInner() method wraps the specified HTML element around all content (innerHTML) within each selected element.


Syntax

Parameter Description
wrappingElement Required. Specifies the HTML element to wrap around the content of each selected element. Possible values: HTML element<br> jQuery object<br> DOM element
function (index) Optional. Specifies a function that returns the wrapping element. index - Returns the index position of the element in the set.

More Examples

Create New Element via DOM

Wrap Content Using Function


jQuery HTML/CSS Methods

❮ Traversing Closest Traversing Has ❯