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.