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 8300221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:28:23+00:00 2026-06-08T16:28:23+00:00

I am trying to build up a jQuery set using add() but my implementation

  • 0

I am trying to build up a jQuery set using add() but my implementation is not adding elements to the set.

 var questionPath = $(); // create empty set
    var selectedRuleElement = $(event.currentTarget);
    questionPath.add(selectedRuleElement); //no element is added to set here!
    selectedRuleElement.find('li.property-value-node').each(function () {
        var questionId = $(this).attr('data-parent-id');
        questionPath.add($('#' + questionId)); // or here!
    });
    return questionPath;

Both of the above add() lines are given a valid element as an argument. Can someone tell me the correct way to add elements to a jQuery set?

  • 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-08T16:28:25+00:00Added an answer on June 8, 2026 at 4:28 pm

    Like strings, jQuery objects are immutable, so you need to re-assign the returned value. Otherwise you’re discarding the value returned by .add() and questionPath remains unaltered.

    questionPath = questionPath.add(selectedRuleElement);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to build call to action button on my site using jQuery. I
I have a simple jQuery script that I'm trying to build upon but I
I am trying to build an interactive map using an imagemap and jquery. I
I'm trying to build a site that runs without refreshes, using Jquery and PHP
I'm trying to build out an accordion menu with jQuery but am running into
I'm trying to build an simple publishing tool in jquery. But i'm a bit
I'm trying to build a basic contact form using jQuery. The markup is essentially
I'm trying to build a calendar style accordian in jQuery. So a set of
I'm trying to build a basic resizing script using just raw jQuery v1.5.1 (Script
I'm trying to build my first jquery plugin but i get the following error:

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.