Variations on Adding elements

Learn how to use several methods to add the elements in an existing HTML page.

Adding a textual node

Instead of using the textContent property to define the new element’s textual content, you can create a textual node with the createTextNode() method. This node can then be added to the new element with appendChild(). The following code demonstrates ...

Access this course and 1400+ top-rated courses and projects.