.pushStack()

Add a collection of DOM elements onto the jQuery stack.

.pushStack(elements)🡢 jQuery

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

.pushStack(elements, name, arguments)🡢 jQuery

elements ArrayAn array of elements to push onto the stack and make into a new jQuery object.
name StringThe name of a jQuery method that generated the array of elements.
arguments ArrayThe arguments that were passed in to the jQuery method (for serialization).

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

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

Looking for a Web Developer?

👋

Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)