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!
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
Joseph Quintiliano
Front End Web Development Techdegree Student 10,513 PointsI dont understand the concept of a function in the video
function attachRemoveButton(li){ let remove = document.createElement('button'); remove.className = 'remove'; remove.textContent = 'Remove'; ***li.appendChild(remove)** }
What i do not understand is why or even how we are appending an element like a button to a list item. i would understand if I had been asked to append a new an LI element to a UL element... but to append a button elemtn to a LI element doesnt visually sit right with me. Could someone please help me digest this better
2 Answers

Steven Parker
224,936 PointsA list item can contain many different kinds of things, buttons included. You forgot to provide a link to it, but didn't the video show what the screen looks like with the button added?

Joseph Quintiliano
Front End Web Development Techdegree Student 10,513 Pointsall good, i forgot that the appendChild function also meant youre just giving an element another child. go figure. Thanks for your time though!
Steven Parker
224,936 PointsSteven Parker
224,936 PointsJoseph Quintiliano — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!