The basic idea is pretty simple. Let's begin with the JavaScript object:
apps = {
app1:
[
"ci-extension",
"Unnamed",
"<h1>Hello world!</h1>"
],
app2:
[
"ci-extension",
"Another one!",
"Cool!"
],
}
I have the following variables set up already to help me with my case:
_Meta["app1", "app2"]
_Ammount2
Now, what I need to do is create a <div> with its ID attribute set to key's name (e.g. "app1", or _Meta[0]) then in this <div> add a new div element with its class attribute set to "window-header" and in this div write in the following:
<i class="ci-pro {line 1 of they key's value}"></i> {line 2 of the key's value}. And finally, a new div with line 3 of the key's value as content.
Example:
<div id="app1">
<div class="window-header"><i class="ci-pro ci-extension"></i> Unnamed</div>
<div>
<h1>Hello world!</h1>
</div>
</div>
and the same goes for all other keys.
What I tried?
JavaScript:
for (var i = 0; i < _Ammount; i++) {
var tmp = meta[i];
console.log(apps.tmp); //returns: undefined, undefined
}
//and also...
for (var i = 0; i < _Ammount; i++) {
var tmp = meta[i];
console.log(apps + "." + tmp); //returns: [object Object].app1, [object Object].app2
}
And everything else is using jQuery append to create the elements and fill in the needed infrmation.
So, how do you make the for return an object with each key's values?
My mind is obfuscated at its maximum levels, so any help would be highly appreciated. Thanks in advance!
apps[ tmp ]notapps+"."+tmporapps.tmp. The latter is accessing the property literally named tmp, and the other is just making a string, not using the value oftmpas a accessor toapps. Look at property accessors