[javascript - jQuery] creating nested array's on the fly
- by adardesign
What i am trying to do is to loop this HTML and get an nested array of this HTML values that i want to grab.
This script is just part of a whole function.
html
<div class="configureData">
<div title="Large">
<a href="yellow" title="true" rel="$55.00" name="sku22828"></a>
<a href="green" title="true" rel="$55.00" name="sku224438"></a>
<a href="Blue" title="true" rel="$55.00" name="sku22222"></a>
</div>
<div title="Large">
<a href="yellow" title="true" rel="$55.00" name="sku22828"></a>
<a href="green" title="true" rel="$55.00" name="sku224438"></a>
<a href="Blue" title="true" rel="$55.00" name="sku22222"></a>
</div>
<div title="Large">
<a href="yellow" title="true" rel="$55.00" name="sku22828"></a>
<a href="green" title="true" rel="$55.00" name="sku224438"></a>
<a href="Blue" title="true" rel="$55.00" name="sku22222"></a>
</div>
</div>
javascript
// this is part of a script.....
parseData:function(dH){
dH.find(".configureData div").each(function(indA, eleA){
colorNSize.tempSizeArray[indA] = [eleA.title,[],[],[],[]]
$(eleZ).find("a").each(function(indB, eleB){
colorNSize.tempSizeArray[indA][indB+1] = eleC.title
})
})
},
I expect the end array should look like this.
[
["large",
["yellow", "green", "blue"],
["true", "true", "true"],
["$55", "$55","$55"]
],
["Medium",
["yellow", "green", "blue"],
["true", "true", "true"],
["$55", "$55","$55"]
]
]
// and so on....