While creating and inserting dom element's, it seems that the fuctions used for the task are returning before the elements show in the page.
Before starting to insert the elements i set the display property of a div to 'block' and after inserting the elements i set the property to 'none', the problem is, the indicator is not showing in the page. It's possible to accomplish this? Where $ is an alias for document.getElementById.
$('loading').className="visible";
var container = document.getElementById('container');
for(var i=0; i< 50000; i++){
var para = document.createElement('p');
para.appendChild(document.createTextNode('Paragraph No. ' + i));
container.appendChild(para);
}
$('loading').className="hidden";
It appears as createElement and/or appendChild run asynchronously, so I'm hiding the indicator almost immediately???