Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8363431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:10:25+00:00 2026-06-09T12:10:25+00:00

Possible Duplicate: How does the jQuery pushStack function work? In the jQuery API I

  • 0

Possible Duplicate:
How does the jQuery pushStack function work?

In the jQuery API I saw a function pushStack. The description sais: Add a collection of DOM elements onto the jQuery stack.

Does anyone know wat the jQuery stack is and for what can it be used? Does it has a relation with the DOM?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:10:26+00:00Added an answer on June 9, 2026 at 12:10 pm

    When you chain multiple jQuery methods together and each method returns a new jQuery object, jQuery keeps track of all the jQuery objects in a stack. This allows you to return to a previously used jQuery object without having to save it in a local variable. To make this work, when a jQuery method creates a new jQuery object as a result of a method call, it calls pushStack() to allow the new object to participate in the stack.

    The jQuery method .end() is somewhat the reverse of .pushStack() in that it goes one item back in the stack to get the prior jQuery object and it can be called multiple times to continue going back in the stack. See the .end() doc for more info.

    For an example of using .pushStack(), let’s say you wanted a method that would get all text nodes in a container, you could do so like this and return the new resulting jQuery object using .pushStack():

    jQuery.fn.textNodes = function() {
        var nodes = [];
        this.each(function() {
            var node = this.firstChild;
            while (node) {
                if (node.nodeType == 3) {
                    nodes.push(node);
                }
                node = node.nextSibling;
            }
        });
        return this.pushStack(nodes, "textNodes");
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: how does jquery chaining work? This is a normal thing you would
Possible Duplicate: What does (function($) {})(jQuery); mean? For the function (function($){})(), I've seen it
Possible Duplicate: jQuery question: what does it really mean? For example, (function (exports, $,
Possible Duplicate: How does jQuery .data() work? In jQuery, .data reads the values of
Possible Duplicate: What does (function($) {})(jQuery); mean? I've seen a lot of jQuery code
Possible Duplicate: Does anyone know of a good C# API for Subversion? I'm designing
Possible Duplicate: How does this CSS triangle shape work? Please help me i need
Possible Duplicate: What does jQuery.fn mean? I have some script on a page trying
Possible Duplicate: How to create a JQuery Clock / Timer Does anyone knows countdown
Possible Duplicate: What does this “(function(){});”, a function inside brackets, mean in javascript? javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.