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 trialJoseph Quintiliano
Front End Web Development Techdegree Graduate 14,338 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
231,269 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 Graduate 14,338 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
231,269 PointsSteven Parker
231,269 PointsJoseph Quintiliano — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!