jquery/web-learn-jquery-com — Issue #23: Correction to Part III - Append New Content Outside Loop
Author: JamesDunlop
Created: 2011-10-11 02:49:21+00:00
State: open

Example using createDocumentFragment should be as follows:

// better: do this
var frag = document.createDocumentFragment();

$.each(myArray, function (i, item) {
var newListItem = document.createElement("li");
newListItem.textContent = item;
frag.appendChild(newListItem);
});
$('#ballers')[0].appendChild(frag);