+1 vote

2 Answers

0 votes
Best answer
elem.innerHtml, because it is shorter, and therefore:
Your code will be downloaded to the user faster%3ВСервер and the computer user will spend less electricity%3ВТвой small contribution for the preservation of clean air (if electricity is taken from coal combustion) will be reckoned to you in karma.
+1 vote
elem.the innerHTML setting trendedit string as html code, the previous contents of the element will be deleted, not working on text nodes and comment nodes
elem.innerText setting the value to replace the contents of a string, as text, the special characters would display correctly, does not work on text nodes and comment nodes
2 these properties are non-standard, but supported in all browsers
elem.textContent will set the contents of any node (not sure about the nodes of the document), the installation works as innerText, there are differences when reading
elem.firstChild.nodeValue sets the text content for text nodes, comment nodes, and CDATA node, will have no effect if the first node of a different type, won't touch the other child node will throw an error if the element is empty (since elem.firstChild will be null)