Advantages of createElement over innerHTML?
There are several advantages to using createElement instead of modifying innerHTML (as opposed to just throwing away what’s already there and replacing it) besides safety, like Pekka already mentioned: Preserves existing references to DOM elements when appending elements When you append to (or otherwise modify) innerHTML, all the DOM nodes inside that element have to … Read more