javascripthtmldominnerhtml

What is the innerHTML property for?


The innerHTML property is used to change the text inside an HTML element. Is this the only thing that innerHTML will do (or) are there any other uses?


Solution

  • Nope, it's a setter and getter for the serialised DOM of all children elements from the reference.

    It should not be used because you want to change the text inside (there's textContent for that).