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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:00:03+00:00 2026-05-27T09:00:03+00:00

First, let me just mention that this is my first attempt at a from-the-ground-up

  • 0

First, let me just mention that this is my first attempt at a from-the-ground-up jQuery plugin.

For starters, I want my plugin to accept user defined options (+parms) via an object. For example:

<script>
    $(document).ready(function() {
        $('.myClass').augaetrk({
            myobja : {zero:'obj00 zero',one:'obj01 one',two:'obj02 two'},
            myobjb : {zero:'obj10 aaa',one:'obj11 bbb'}
        });
    }); 
</script>

Note: The names of those objects will not be predefined. They will be at the discretion of the developer using the plugin.

To cut a long story short, within the plugin I parse (for example) a link’s CSS classes to identify which user parms object I should be using further into the plugin. For example.

<a class="other-class-1 this-myobja otherclass-2" href="http://mylink.com">some link</a>

I can get the class – in this case this-myobja and the name of the object I need, myobja. What I can’t seem figure out is how to use that string/value as the name of the object whose parm values I want to access/utilize.

At the moment, I’m each’ing through the options and using a simple if to get to the object I want. It works but I would think I’m adding a lot of unnecessary overhead. In PHP I would use a $$ but I can’t seem to find that equivalent in jQuery.

How can I take the value I’m getting from parsing the link’s class= and then use the value to get corresponding (user) options?

If you’re able to help please type slow and assume I know even less than you think I might know. While probably a slightly advanced programming concept, I’m by no means an advanced – or even average – jQuery developer. I’m sure you’re busy but if you give an answer/example please keep in mind I’m trying to learn so a bit of explanation would be greatly appreciated. Thanks.

  • 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-27T09:00:05+00:00Added an answer on May 27, 2026 at 9:00 am

    If you can get the name of the relevant part of your object from the class of the a, then you can reference it like this: object["stringKey"] or object[variable]. Given your example:

    // this object mimics the object passed to your plugin
    var myobj = {
        myobja: {
            zero: 'obj00 zero',
            one: 'obj01 one',
            two: 'obj02 two'
        },
        myobjb: {
            zero: 'obj10 aaa',
            one: 'obj11 bbb'
        }
    }
    
    var objectName = "myobja"; // This would be the value from the A elements' class
    alert(myobj[objectName].zero)
    

    Example fiddle

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

Sidebar

Related Questions

First, let me just say that I have searched for information on this topic;
Ok. First let me say that I just started learning jQuery and I've taken
First let me mention that I've gone through many suggested questions and found no
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
First let me just state that coding without unit testing is just plain crazy.
Just to let you know this is my first question im posting on this
First of all, just grant that I do in fact want the functionality of
First of all let me just note that i'm a newbie in the field.
First let me say that I have been working on this issue for about
First let me say that I do appreciate greatly everyone's suggestions and comments. This

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.