I would like to know when my iteration
completes from outside of my web page, where my iteration happening inside of a frame's
child iframe
here my example: Live URL click first button and second button wait 3 sec.
$(function(){
var total = 1000;
var i = 0;
var iterate = function(){
setTimeout(function(){
var place = $('#iFrame1').contents().find('#iFrame2').contents().find('body');
place.append('<ul class="list"></ul>');
for(i=0; i < total; i++) {
place.find('.list').append('<li>'+i+'</li>');
}
}, 3000);
//how to find all this done from outside of this function?
}
var iFrame1 = $('<iframe />', {id:'iFrame1'});
var iFrame2 = $('<iframe />', {id:'iFrame2'});
var button2 = $('<button />', {text:'Child Button', click:iterate});
var button = $('<button />',
{
text:'Click Me',
click:function(){
$(this).parents('body').append(iFrame2);
$('#iFrame1').contents().find('#iFrame2').contents().find('body').append( button2 );
}
}
);
setTimeout(function(){
$('.container').append( iFrame1 );
$('#iFrame1').contents().find('body').append(button);
},1000);
});
After the place
had all li
s how to I know from outside of the document. I am running my code from chrome browser console.