Take the tour ×  i have this code but i dont know what to do
next..  var toBeInsertedToAS = "";      $('<img />')
toBeInsertedToAS += $(this).attr('src')+"|";
i just want to have this output..   but as what i can see, after
the loop, there's no output.. maybe because it goes to
alert(toBeInsertedToAS) without loading the pictures
completely.. i just want to completely load the pictures first
before it will execute the alert..  share|improve this question
add comment  1 Answer  up vote 0 down vote accepted  You can
rearrange it a bit, like this:  var toBeInsertedToAS = [],
theSetDataCount = 0;      $('<img />').one('load', function(){
if(toBeInsertedToAS.length == theSetDataCount)
.each(function() {  You can test it here, this demo loads images
from http://dummyimage.com/ as a source.  The load event happens
when the image loads, not a synchronous thing, though it will be
instant if it's from cache. From cache also won't fire the load
event in