wrapAll() method in jQuery

wrapAll() in jQuery

This method is used to wrap an HTML structure around all elements in the set of matched elements.

Syntax 1

$(selector).wrapAll(wrappingElement)

  • wrappingElement - A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
Syntax 2

$(selector).wrapAll(function(index))

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

Example 1

Try Yourself

Example 2 - with function

Try Yourself