Storing elements in memory to prevent updating the DOM too often?
问题 Currently I have a loop that updates the DOM in each iteration; I have learned this is a bad practice & you should update the DOM as little as possible for better speed. So I was wondering how I go about editing the below so I can store all the elements in one element or something & then do a single DOM addition once the loop ends. Here is the loop.. for (var i = spot; i < spot + batchSize && i < cats.options.length; i++) { // Check if the cat is selected if (cats.options[i].selected == true)