Isn't it the same as doing this? $('span.countdown').each(function(){...}); updateCounter();
The updateCounter function will only run after each() has returned/ finished. On Jan 23, 2:43 pm, Ariel Flesler <afles...@gmail.com> wrote: > if( $('span.countdown').length ){ > updateCounter(); > > } > > -- > Ariel Fleslerhttp://flesler.blogspot.com > > On 23 ינואר, 11:39, johannesf <johannes.foss...@gmail.com> wrote: > > > Hi > > > jquery is fantastic :-) > > > My problem: I have a simple each-loop and after the loop I want to run a > > js-function. > > > How can I determine when the each-loop is done in a more elegant way then > > this! > > > ------------------------------------------------------------------------- > > > var flag = false; > > > $('span.countdown').each(function(){ > > > flag = true; > > > }); > > > // when the loop is done, run 'updateCounter()' > > if(flag == true){ > > > updateCounter(); > > > } > > > all the best / johannes > > > -- > > View this message in > > context:http://www.nabble.com/run-function-when-%27each%27-is-done%2C-how--tp... > > Sent from the jQuery General Discussion mailing list archive at Nabble.com.