wrap() method in jQuery

wrap() in jQuery

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

Syntax 1


  • wrappingElement - It can include selector, element, HTML string, or jQuery object to be to wrapped around the matched elements.
Syntax 2


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

Example 1

Try Yourself

Example 2 - with function

Try Yourself