Why is “element.innerHTML+=” bad code?
Every time innerHTML is set, the HTML has to be parsed, a DOM constructed, and inserted into the document. This takes time. For example, if elm.innerHTML has thousands of divs, tables, lists, images, etc, then calling .innerHTML += … is going to cause the parser to re-parse all that stuff over again. This could also … Read more