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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Nicholas Wallen](https://secure.gravatar.com/avatar/05ef5337a0dcd24e5acf273a6f84afa4?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Nicholas Wallen
12,278 PointsWithin the ul event listener, why is li referred to as a parent of ul? Isn't it the opposite?
ul.addEventListener('click', (e) => {
if (e.target.tagName === 'BUTTON') {
const button = e.target;
const li = button.parentNode;
const ul = li.parentNode;
4 Answers
![KRIS NIKOLAISEN](https://secure.gravatar.com/avatar/65d74a723997b41a80d2d909c6e06960?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
KRIS NIKOLAISEN
54,969 PointsFrom what you posted it looks like li is the parent of button and ul is the parent of li.
![Othneil Drew](https://secure.gravatar.com/avatar/48a2a2c43b85ad0b072a39c5ca872cdb?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Othneil Drew
22,421 Points"parentNode" is telling the browser to traverse the DOM to get the parent of the selected element.
const li = button.parentNode
is finding the parent of the button and setting the li value to the button's parent. In this case the li element.
const ul = li.parentNode
if finding the parent of the button and setting the ul value to the li's parent. In this case the ul element.
![Andrew Tiller](https://uploads.teamtreehouse.com/production/profile-photos/10700715/micro_avatar.jpg)
Andrew Tiller
4,182 Points<ul> is an "Unordered List" of <li> "List Items" which contain <button>s. button.parentNode will return the <li> the <button> is in. li.parentnode will return the <ul> that the <li> is in.
[element].parentNode doesn't assign something as a parent, it returns the parent of that element.
![Michael Kristensen](https://uploads.teamtreehouse.com/production/profile-photos/9307342/micro_Portrait.jpg)
Michael Kristensen
Full Stack JavaScript Techdegree Graduate 26,251 Pointsbutton.parentNode is you asking for 'the parent of this button', and li.parentNode is you asking for 'the parent of this list item', so as written the behaviour is as you are describing; ul is the parent of li, who in turn is the parent of button.