I have basically created a main object like below:
var seriesOptions = {
y: +parseFloat($(this).find('y').text()).toFixed(2),
color: colors[index],
level : dlevel
};
Now I keep adding new property with values to the above object like:
var drilldown {
name : $(series).children('name').text(),
level : dlevel + 1,
color: colors[index]
};
var data {
values : []
}
for .. each
data.values.push(..)
drilldown['data'] = data;
seriesOptions['drilldown'] = drilldown;
The above code goes in an main for .. each loop. So when the main loop ends I have something like below object layout:
seriesOptions
drilldown
data
drilldown
data
......................................
Now I want to access the last data node of a particular name in seriesOptions – as per example above for last ‘drilldown’ note in seriesOptions would be seriesOptions.drilldown.data.drilldown – how can I access the last object of type data in seriesOptions? I want to add another property and its values to it like:
seriesOptions
drilldown
data
drilldown
data
<finalobject>
Are you asking this
http://api.jquery.com/last-child-selector/