Answers for "pros/cons of using `.createElement()` and `append()` vs. `.innerHTML`?"

0

pros/cons of using `.createElement()` and `append()` vs. `.innerHTML`?

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 be re-parsed and recreated. Preserves event handlers attached to any DOM elements. Could be simpler/faster in some cases.
Posted by: Guest on November-28-2020

Code answers related to "pros/cons of using `.createElement()` and `append()` vs. `.innerHTML`?"

Browse Popular Code Answers by Language