Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery wrapAll() method

jQuery wrapAll() method

jQuery HTML/CSS methods jQuery HTML/CSS methods

Example

in

Wrap all elements in a

element:

$

(

"

button

"

)

.

click

(

function

(

)

{

$

(

"

p

"

)

.

wrapAll

(

"

"

)

;

}

)

;

Try it »


Definition and Usage

The wrapAll() method wraps all selected elements with the specified HTML element.


Syntax

$(

selector

).wrapAll(

wrappingElement

)

Parameters Description
wrappingElement Required. Specifies the HTML element used to wrap the selected elements.

Possible values:

  • HTML element
  • jQuery object
  • DOM element
  • |

    More examples

    Creating a new element via the DOM
    How to use document.createElement() to create an element and wrap all selected elements with it.


    jQuery HTML/CSS methods jQuery HTML/CSS methods