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

  • SEARCH
  • Home
  • 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 7862747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:15:50+00:00 2026-06-02T23:15:50+00:00

Related to my Question , I am facing trouble getting all elements I want

  • 0

Related to my Question, I am facing trouble getting all elements I want to get all elements of a class using dojo.query
my code is as below;

var jsonRoles = {"roles": [
                            {"roleId": "1", "roleName": "role1", "roleDesc": "This is role1"},
                            {"roleId": "2", "roleName": "role2", "roleDesc": "This is role2"},
                            {"roleId": "3", "roleName": "role3", "roleDesc": "This is role3"}
                        ]
                    };
                    var results="";
                    for(var i=0;i<jsonRoles.roles.length;i++){
                        results += '<div class="dojoDndItem ">' + '<span style="visibility: hidden">' + jsonRoles.roles[i].roleId + '</span>' + jsonRoles.roles[i].roleName  + '</div>';
                    }
                    var list = dojo.query(".dojoDndItem");

I want to store elements with class name dojoDndItem in variable “list” but when i inspect the “list” in firebug, it gives me “[]” (empty array). Am I doing something wrong?

  • 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-02T23:15:52+00:00Added an answer on June 2, 2026 at 11:15 pm

    dojo.query returns an array of matching DOM nodes from the page based on a CSS selector.

    The variable results in your question is just a string with text like:

    <div class="dojoDndItem"><span style="visibility: hidden">...
    

    It’s just a string. It’s not an array of DOM elements, nor have you added any new elements to the page DOM itself, so unless there are pre-existing elements with the dojoDndItem class, empty array [] is the correct result.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a dilemma related to another question but not exactly the same.
Related question [stackoverflow] here . I'm trying to do the above, but I want
In a related question I asked how to get input via IUP . This
I have read other related question but i cant really get them to relate
I am facing a compilation error on using transform: It is related to my
Related question: How to detect integer overflow? In C code, should integer overflow be
Related Question: vector <unsigned char> vs string for binary data . My code uses
I asked a related question here: Clojure: How do I turn clojure code into
I have asked a related question , but I did not get a satisfactory
related question with unsatisfactory answers: Changing CSS Values with Javascript Here's what I want

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.