en.javascript.info/2-ui/1-document/07-modifying-document/1-createtextnode-vs-innerhtml/task.md
Ilya Kantor 508969c13f up
2017-02-28 12:54:48 +03:00

276 B

importance: 5


createTextNode vs innerHTML vs textContent

We have an empty DOM element elem and a string text.

Which of these 3 commands do exactly the same?

  1. elem.append(document.createTextNode(text))
  2. elem.innerHTML = text
  3. elem.textContent = text