jQuery API

jQuery.pushStack()

jQuery.pushStack( elements ) Returns: jQuery

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

  • version added: 1.0jQuery.pushStack( elements )

    elementsAn array of elements to push onto the stack and make into a new jQuery object.

  • version added: 1.3jQuery.pushStack( elements, name, arguments )

    elementsAn array of elements to push onto the stack and make into a new jQuery object.

    nameThe name of a jQuery method that generated the array of elements.

    argumentsThe 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();

Comments

  • Support requests, bug reports, and off-topic comments will be deleted without warning.

  • Please do post corrections or additional examples for jQuery.pushStack() below. We aim to quickly move corrections into the documentation.
  • If you need help, post at the forums or in the #jquery IRC channel.
  • Report bugs on the bug tracker or the jQuery Forum.
  • Discussions about the API specifically should be addressed in the Developing jQuery Core forum.