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

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Creating Elements

On line 1 of app.js, create a new div element and assign it to newDiv.

I only got this far and am stuck. Please help.

var newDiv = document.createNewElement("div");
var newDiv;
var newSpan;

I have no idea what to do and Google could not help me.

Thank you!

3 Answers

Gabriel Tartaglia
Gabriel Tartaglia
41,581 Points

Hi Tukka,

The correct method name is createElement, take a look at the documentation to see more details about it.

Ow! And you do not need to reinitialize it in the second line. Try again, but if the problem persists, here is the answer:

var newDiv = document.createElement("div");
var newSpan;
Sreng Hong
Sreng Hong
15,083 Points

Hi Tuukka

The method is createElement(), not createNewElement(). Changing that it should be fine.

Thank you so much!

Now it was easy :)