var idImg=[] $('img').onload(function() { alert($(this).attr('data-index')); this.id=$(this).attr('data-index'); idImg.push([this.id,this.src]); //Можно воткнуть id и src в массив загруженных });