JavaScript JavaScript and the DOM Responding to User Interaction The Event Object

Hamdi Elshahat
Hamdi Elshahat
2,565 Points

Everything is well explained, But why he didn't select the ul instead of listDiv since ul is the closest parent to li?

The Event Object video everything is well explained, But why he didn't select the ul instead of listDiv since ul is the closest parent to li and it would never be removed even if we remove every single li element?

2 Answers

Steven Parker
Steven Parker
207,988 Points

Selecting the <ul> should work the same for this particular list, but should other lists be added to the <div> later, the choice as shown would extend the highlighting effect to them also.

However, whether this advance planning is intentional or not is not clear from the video.

Because most things have been very unclear so far. He goes from saying parent which is UL to something completely different. I have no idea what he is doing.