It is only returning the information of the last entry because you overwrite 'teste' two times. When I change the setting to:
var collectionElements = { teste1: { var1: 'teste[]', var2: 'brincadeira-2', var3 : 'Elemento 2' }, teste2: { var1 : 'teste[]', var2 : 'brincadeira-3', var3 : 'Elemento 3' }, teste3: { var1 : 'teste[]', var2 : 'brincadeira', var3 : 'Elemento 1', teste: { var1 : 'teste[]', var2 : 'brincadeira-4', 3 : 'Elemento 4' } } }; Your functions seems to work. On Fri, Apr 24, 2009 at 3:54 PM, Bruno Gama <bga...@gmail.com> wrote: > > Hi I would like to know if there is a simple way to show all elements > of that variable? > var collectionElements = { > teste: { > var1: 'teste[]', > var2: 'brincadeira-2', > var3 : 'Elemento 2' > }, > teste: { > var1 : 'teste[]', > var2 : 'brincadeira-3', > var3 : 'Elemento 3' > }, > teste: { > var1 : 'teste[]', > var2 : 'brincadeira', > var3 : 'Elemento 1', > teste: { > var1 : 'teste[]', > var2 : 'brincadeira-4', > 3 : 'Elemento 4' > } > } > }; > > I am tryin' to iterate all elements using this function (for debug > only) > > function iterateAllElements( elements ) { > var ret = ''; > jQuery.each( elements, function( i,val ) { > ret += ( typeof val == 'object') ? '\n Node ' + > iterateAllElements > ( val ) : i + ' : ' + val + ' / '; > }); > return ret; > }; > > With this function my firebug Console outputs only the last object > (3th node) with its child object. > > Sorry my bad english! ^^ >