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 Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perform: Appending and Removing Elements

rajbee
rajbee
6,657 Points

Why look at node properties in MDN website to find parent of an element ?

At 3:50, he wants to get the parent element (li) of a checkbox element. He did not find any property for that in the element page's properties list. He then scrolls up and clicks the link for node and finds Node.ParentNode. How did he know that he must look at Node and not some other link in the MDN ?

2 Answers

I believe they explain in one of the earlier videos that each element is a Node in the DOM tree. When moving between elements you are traversing the DOM so you are dealing with nodes (it doesn't matter if it's a div, an li, or a span) and their relationships. I don't think it's something that a random person would just get right away, but they are instructors trying to reinforce that point most likely.

rajbee
rajbee
6,657 Points

Memory is fuzzy here. Is a node a javascript representation of a html element ? DOM ==> HTML Doc and Node ==> Html element ?

never explained. this guy doesnt explain anything

I agree with the last comment...