brianmfalls
asked on
How do I run a function after all of my html files have completed loading via jQuery .load()?
Using a setTimeout function is just to hacky... I need to run some scripts after all of the documents are loaded. Load time varies from server to server, so setTimeout is not only hacky, it's unreliable at best. How do I run a function after all of my html files have completed loading via jQuery .load()?
for (i = 1; i < 53; i++) {
if (i.toString().length == 1) {
index = '0' + i.toString();
} else {
index = i;
};
$('#manualBody').append('<div id="chapter'+index+'Container"></div>');
$('#chapter'+index+'Container').load('docs/chapter'+index+'.html');
};
setTimeout(function(){
for (i = 1; i < 7; i++) {
$('#manualBody').find('h'+i).attr('id','fullManual');
};
}, 2800);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER