jQuery pushStack()Method

jQuery 杂项方法jQuery Miscellaneous Methods

Example

First push some elements into the jQuery stack, then delete them, and then revert to the state just before they were pushed.

<div></div> <script> $(function () { $().pushStack( document.getElementsByTagName("div")).remove().end(); }) </script>

Try it Yourself >>

Definition and Usage

The pushStack() function is used to push a collection of DOM elements onto the jQuery stack.


Syntax

Usage 1

pushStack( elements, name, arguments )

Parameters Description
element Array type. The array elements to be pushed into the jQuery stack, used to generate a new jQuery object.
name Optional. String type. The name of the jQuery method used to generate the array elements.
arguments Optional. Array type. Parameters passed to the jQuery method (for serialization).


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions