Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website Creating HTML Content Create Navigation with Lists

it does not work

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Nick Pettit</title> </head> <body> <header

1 Answer

Andrew Winkler
Andrew Winkler
37,739 Points

The term "element" can refer to several things depending on which language your using. For the sake of aid, I'm going to assume you're referring to JavaScript definition, because it's relatively the most frequent.

To add a new element to the HTML DOM, you must create the element (element node) first, and then append it to an existing element. Here's an example:

//This code finds an existing element:
var parent = document.getElementById("div1");

//This code appends the new element to the existing element:
parent.appendChild(para);

Next time please reference the challenge &/ video you're working on in your question so we can all be on the same page.

thank you its work now