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

Code challenge - DOM Manipulation problem

I have encountered some problem in a code challenge. I had to create a new paragraph and assign it to new variable in JS file. I have done it correctly because i can change it text content (3, 4), but when i click "Check work" - I'm getting this error: Bummer: Make sure that you assign a '<p>' element to 'newParagraph'.

Screens:

  1. https://gyazo.com/fa966078ae0df861186fb5108bf89b2b
  2. https://gyazo.com/3e2930dd6c351cfa28f2af852ca3db9f
  3. https://gyazo.com/96f65950ff281e03a98b74f53f11bec9
  4. https://gyazo.com/347c159d5a83b33d15501d6500a8128d

Gif:

  1. https://gyazo.com/9da0e4dd29d5e9d8d1a48890bb50b440

Have I done something wrong or is it a bug?

2 Answers

Ignacio Rocha
Ignacio Rocha
7,462 Points

Actually you didn't do it correctly. In the first challenge task you have to CREATE a paragraph element using Javascript, all you did was create it directly in the html

the right way is using the createElement method.

var newParagraph = document.createElement('p');

I see. Thank you for answer! I thought i had to create paragraph in HTML file.