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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:17:44+00:00 2026-05-28T02:17:44+00:00

I have a Javascipt object which I use as dictionary var obj={ xxx:’1′ yyy:’2′

  • 0

I have a Javascipt object which I use as dictionary

var obj={
           xxx:'1'
           yyy:'2'
        }

However –
xxx and yyy should be a jQuery object.

something like :

var obj =
          { 
             $('#div1'):'1' , 
             $('#div2'):'2'
           }

is it possible ?

also, How can I get the “value” for key $('#div2') ?

p.s.
I the $.data cant help me here since its also a key value
and i need in the key – object Type also.

  • 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-05-28T02:17:44+00:00Added an answer on May 28, 2026 at 2:17 am

    Object keys can only be strings ( or Symbol), period. See Member Operators – Property Names @ MDN.

    Choose a reasonable string representation, and use that. In this case, I’d say the selector string looks like a decent choice:

    { 
        '#div1': '1', 
        '#div2': '2'
    }
    

    also, How can I get the "value" for key $('#div2') ?

    Use one of the member operators, either dot notation

    var obj = { /* stuff */ };
    var value = obj.propertyName;
    console.log(value);
    

    or bracket notation (more useful for property names not known until runtime):

    var value = obj['propertyName'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I´m asking for advice. I have function which should return javascript object function
I have a javascript dictionary object which has a pre-set keys that are defaulted
I have a javascript object, which I've added a number of prototyped functions to,
I have a working JavaScript code below which dynamically creates JSON object using JSON.parse
I have a Javascript object created as follows: var ccStatTracker = (function (){ ccmap:{
I have a javascript object like so: var object = [{ id: 1, title:xyz
I have a javascript object with a bit of jquery for visual effect. I
I have javascript object which consists of complex array of structures with nested structures
i have an object which holds a user name and job count, which then
I have a fairly complex object which has some C# code written to render

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.