Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I mimic PHP $$ (double dollar sign) in jQuery
    primarykey
    data
    text
    <p>First, let me just mention that this is my first attempt at a from-the-ground-up jQuery plugin.</p> <p>For starters, I want my plugin to accept user defined options (+parms) via an object. For example:</p> <pre><code>&lt;script&gt; $(document).ready(function() { $('.myClass').augaetrk({ myobja : {zero:'obj00 zero',one:'obj01 one',two:'obj02 two'}, myobjb : {zero:'obj10 aaa',one:'obj11 bbb'} }); }); &lt;/script&gt; </code></pre> <p>Note: The names of those objects will not be predefined. They will be at the discretion of the developer using the plugin.</p> <p>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.</p> <pre><code>&lt;a class="other-class-1 this-myobja otherclass-2" href="http://mylink.com"&gt;some link&lt;/a&gt; </code></pre> <p>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. </p> <p>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. </p> <p>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? </p> <p>If you're able to help <em>please</em> 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. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload