Don't use append inside loops
Bad practice:
$.each(hereArray, function(i, item) {
var listItem = "<li>" + item + "</li>";
$("#coolList").append(listItem);
});
Good practice:
var listItems = "";
$.each(hereArray, function(i, item) {
listItems += "<li>" + item + "</li>";
});
$("#coolList").append(listItems);
Written by merezha
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#