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 DOM Scripting By Example Adding and Removing Names Registering Names

ul.appendChild(li)? Shouldn't it be this instead?

At 6:15, Shouldn't it be this instead?

invitedList.appendChild(li);

Kind of confused here.

1 Answer

Steven Parker
Steven Parker
229,732 Points

The name "invitedList" is an ID of an element in the HTML, but it's not a variable. And on line 9, that HTML element was assigned to the variable "ul":

  const ul = document.getElementById('invitedList');

So "ul" is the correct variable name to use when appending the new list item.

Does that help to make it more clear?

Gotcha! Thanks!