Chapter 12: Objects and the DOM

Return to Chapter 12

 

To use this script on your own page, click in the text area below, select all, and copy to grab the script. Then, just paste into your own page — and you're done.

Adding Nodes

See it run: Adding Nodes

Script 12.1

This HTML creates the text area and submit button that allows the user to add a text node.

Script 12.2

With this JavaScript, the user can add any text they want to the page.