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 trialMuaaz Matwadia
Full Stack JavaScript Techdegree Graduate 19,327 PointsInput.value
How does the code know to input the user value under invitees cause you saying li.appendChild ?
1 Answer
Heidi Fryzell
Front End Web Development Treehouse Moderator 25,178 PointsHi Azzie,
In the text variable in the line below, "text" is set to equal the input value, what is entered in the form's input text box.
const text = input.value;
The text gathered in the input value is stored in the variable "text"( in the line above), we are setting the text content of the li element to be that "text" variable in this line below:
li.textContent = text;
This line below is where the text value gets written to the page. It is saying go to the "ul" variable and append a "li" (list item) to the "ul" (unordered list).
ul.appendChild(li);
And the "li" that it is appending to the "ul" has a text content defined by the variable "text" which equals the input value entered in the form(text input).
I don't know if I did a good job of explaining, Maybe some other Community members will chime in as well.
Happy coding!