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 JavaScript and the DOM (Retiring) Making Changes to the DOM Creating New DOM Elements

Can anyone explain this?

At 3.02, line 25

li.textContext = addItemInput.value;?

Steve Hunter Steven Parker

1 Answer

Steven Parker
Steven Parker
231,271 Points

:bell: Hi, I got alerted by your tag. But there's many folks around who might help you, so for most questions you won't need to tag anyone specific. You can always add tags later if you don't get a good response after a while.

In this code, "addItemInput" is a reference to the text input control on the page, and the "value" property accesses what the user typed into it. This gets copied into the "textContent" attribute of the new list item element "li" that was created on the previous line.

At this point, nothing will happen that you can see, but in the next video more code will be added that will make changes to the page.