Skip to content

Instantly share code, notes, and snippets.

@GoesToEleven
Created July 19, 2015 20:43
Show Gist options
  • Save GoesToEleven/d3bdbb5b5e563fc9cf93 to your computer and use it in GitHub Desktop.
Save GoesToEleven/d3bdbb5b5e563fc9cf93 to your computer and use it in GitHub Desktop.
javascript innerHTML vs textContent
nodeValue is a little more confusing to use, but faster than innerHTML.
innerHTML parses content as HTML and takes longer.
textContent uses straight text, does not parse HTML, and is faster.
innerText is IE specific and also takes styles into consideration. It won't get hidden text for instance.
http://stackoverflow.com/questions/21311299/nodevalue-vs-innerhtml-and-textcontent-how-to-choose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment