views:

36

answers:

2

Hello

I have a loop created with each, check this example:

$('.foo').each(function(i){
  //do stuff
});

Is there any possibility to run a functions when this loop has ended? Couldn't find it on docs or Google.

I can make it work without this kind of solution, but it's always good to search for and use the simpliest methods.

Martti Laine

A: 

This will execute when the loop ends.

$('.foo').each(function(i){
  //do stuff
});

$('.foo').//whatever you want to do. 
Catfish
Well, this actually didn't work for me. It immediatly executes the next statement without waiting for the loop to end.
Martti Laine
A: 

As requested..

It depends on what you are calling in your each loop. You need to add a callback to those (or at least the one you expect to finish last

CResults