Client side javascript, creation of several elements and show each asap

Posted by Sirius Lampochkin on Stack Overflow See other posts from Stack Overflow or by Sirius Lampochkin
Published on 2010-03-09T10:31:08Z Indexed on 2010/03/09 10:36 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

Client side javascript code create some elements (about 50-100) in cycle:

for (var i = 0; i < list.Length; i++) {
   var obj = document.createElement("DIV");
   obj.innerHTML = "<span class=\"itemId\">" + list[i].Id 
                   + "</span><!-- some more simple code --> ";

   mainObj.appendChild(obj);
}

There is some problem with browser rendering, for example IE just freeze until he finished the cycle and then shows all elements in one time. Is there a way to show each created element separately and immediately after "appendChild()"?

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript