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 RSVP Checkbox

question about something that i dont fully get

Hi. we get a ref to the ul element because the ul element is the parent of the li elements? and the li elements are the grandparent of the label and the checkbox tags.

that is why we used this "event bubbling"? because ul has the "MASTER Access"?

1 Answer

Steven Parker
Steven Parker
231,248 Points

I'm not familiar with the term "master access", but events typically "bubble up" from the triggering element to its parent, grandparent, and so on all the way up to the document itself.

An advantage of attaching a handler to an ancestor element is that with proper code, it takes only that one handler to deal with events generated by any of the descendants. A handler used this way is known as a "delegated handler".