For the purpose of this question lets say we need to append()
1000 objects to the body
element.
You could go about it like this:
Sometimes, jQuery isn't the best solution. If you have a lot of elements to append to the DOM, documentFragment
is a viable solution:
var fragment = document.createDocumentFragment();
for(var i = 0; i < 1000; i++) {
fragment.appendChild(document.createElement('div'));
}
document.getElementsByTagName('body')[0].appendChild(fragment);