Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

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.
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
9+5 =