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 JavaScript and the DOM (Retiring) 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
231,271 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.