jQuery wrap() Method

Last Updated Jul 21, 2015, 12:00:06 PM





jQuery wrap() Method

jQuery wrap() method wraps HTML structure around each element in the group of matched HTMLelement in DOM tree.


Syntax

The jQuery wrap() method takes a parameter as any type of string or object. HTML structure will be wrapped around each of the elements in DOM tree matched elements.

Example

jQuery wrap() method will wraps a div element with red color around all the paragraphs

The above jquery wrap() method example will produce the following output


jQuery wrap() method
Try It Now

Other Advanced jQuery DOM topics you might want to learn
jQuery Basic DOM Methods

jQuery DOM Reference

jQuery DOM Removal

jQuery DOM Insertion Inside

jQuery DOM Insertion Outside

jQuery DOM Insertion Around


Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM