Adding Elements to the DOM

Enter text in the input field and press return.

This app shows how to programmatically add an element to the DOM.

In this example, when you press return, the event handler for the input field creates a new <li> element and adds it to an existing <ul> list in the DOM tree. When the DOM tree changes, the web page refreshes.

Read this tutorial for more detail, or read the source.

See all samples.