How can I properly execute the function f when the each iteration has finished so I can count the elements with that particular class?
This gives 0 instead of 16;
f = check_hfouten();
$.each(rest, function(idx, val,f) {
//alert(idx + ': ' + val);
$('td.info.'+idx).children('span').addClass('fout').attr('title',val).end().parent('tr').find('input').addClass('overlayed').click(function(){$(this).removeClass('overlayed')});
$('.tag_cloud.'+idx).addClass('reminder');
}).function(f);
thanks in adv Richard
The messy way :P
http://jsfiddle.net/cwDjL/
Place the call to
f()
in the body of theeach()
callback:each
is not asynchronous so you don't need a callback. Just call it in sequence: