jQuery each doesn't have a callback-possibility?
Question
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
Solution
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
OTHER TIPS
This will execute when the loop ends.
$('.foo').each(function(i){
//do stuff
});
$('.foo').//whatever you want to do.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow