JavaScript DOM Scripting By Example Adding and Removing Names RSVP Checkbox

status 401
status 401
13,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"?

1 Answer

Steven Parker
Steven Parker
171,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".

Steven Parker
Steven Parker
171,120 Points

bot .net — Did that answer the question?