W3cubDocs

/jQuery

.pushStack()

.pushStack( elements )Returns: jQuery

Description: Add a collection of DOM elements onto the jQuery stack.

  • version added: 1.0.pushStack( elements )

    • elements
      Type: Array
      An array of elements to push onto the stack and make into a new jQuery object.
  • version added: 1.3.pushStack( elements, name, arguments )

    • elements
      Type: Array
      An array of elements to push onto the stack and make into a new jQuery object.
    • name
      Type: String
      The name of a jQuery method that generated the array of elements.
    • arguments
      Type: Array
      The arguments that were passed in to the jQuery method (for serialization).

Example:

Add some elements onto the jQuery stack, then pop back off again.

jQuery([])
  .pushStack( document.getElementsByTagName( "div" ) )
  .remove()
  .end();

© The jQuery Foundation and other contributors
Licensed under the MIT License.
https://api.jquery.com/pushStack