wrapInner() method in jQuery

wrapInner() in jQuery

Wrap an HTML structure around the content of each element in the set of matched elements.

Syntax 1

$(selector).wrapInner(wrappingElement)

  • wrappingElement - An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements.
Syntax 2

$(selector).wrapInner(function(index))

  • index - index position of the element in the set.

Example 1

Try Yourself

Example 2 - with function

Try Yourself