status 40113,816 Points
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"?
Steven Parker171,120 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".