Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript and the DOM!
You have completed JavaScript and the DOM!
Preview
In this video, you'll begin learning how to create new elements and add them to the page. First, you'll create a new element with document.createElement().
Further Reading
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
add them to the page.
0:00
For instance, in a todo list application,
0:01
a user needs a way to add
a todo item to the list.
0:04
This action requires that we provide
a way to add a node to the DOM,
0:08
like the node representing a list item.
0:11
There are various ways you might add
elements to the DOM with JavaScript.
0:14
For example, you learned that setting
an element's innerHTML property to
0:19
a string containing HTML tags, sets
the markup to display within the element.
0:24
But that property replaces all the
existing contents of the element with just
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up