jQuery - Call function once at end of each loop
- by user668499
How can I call a function once at the end of an each loop.
This alerts 'finished' on each loop, I want it once when the loop has finished.
$(function(){
var imgArr=[];
var lis = $('#gallery li')
lis.each(function(){
imgArr.push(this.outerHTML);
$(this).remove();
alertFun();
})
function alertFun(){
alert('finished');
}
})