JavaScript JavaScript and the DOM Making Changes to the DOM Creating New DOM Elements

Stefan Cutajar
Stefan Cutajar
7,745 Points

Can't add list item

Hi, I'm having an issue to add the list item when I click the button the element don't add to the list. There are no errors in the console and I also tried to check again the code with the video but can't figure out whats wrong. This is a snapshot of my work space: https://w.trhou.se/yhr5ujxnlt

1 Answer

Jennifer Nordell
STAFF
Jennifer Nordell
Treehouse Staff

Hi there! You're doing just fine! There's actually nothing wrong here. You've created the li and gotten it all set up. But an li must go inside either an ordered list or unordered list. You will then append the list item to the list and when that's done, you'll put the whole thing on the DOM. Keep in mind that merely creating an element in code doesn't actually put it in the DOM until you tell it to.

At this point in the series, you're exactly where you should be. This should not work at this point. There will be a short 5 question quiz after this video, and the following video will then show you how to take those elements you created and put them on the DOM.

Hope this helps! :sparkles:

Stefan Cutajar
Stefan Cutajar
7,745 Points

Thanks I have just seen the video that teach you how to append the item :)