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 trialRobert O'Toole
6,366 Pointsquestion about parents
ok so i understand these concepts in regards to elements like li, ul, h1 etc... but would an element like a button or input form still be considered an element? i have found myself going back to review because later on in this course when we set event targets i found myself quite lost in figuring out how to do something like "let button=ul.parentNode" if someone can help explain the basic parent children relationship a bit better would help me out a ton! thanks
2 Answers
Steven Parker
231,248 PointsAnything with a tag name is an HTML element, including buttons and inputs.
But the example of "let button=ul.parentNode
" is not likely. Assuming the variable "button" is meant to represent a button element, a button would not be the parent of a ul. In HTML, a "parent" is the same thing as a "container". So this example would suggest that a ul was inside a button.
A more typical example might be something like this:
<ul>
<li><button>Start</button></li>
<li><button>Stop</button></li>
</ul>
In this example, the ul is the parent of two li's, which are each the parent of a button. So you might see code with "let ul=li.parentNode
" or "let li=button.parentNode
".
Robert O'Toole
6,366 Pointsthanks so much. I remember learning all this stuff way back and now i am finding myself reviewing basic HTML again. the reviewing and going back seems to be a pretty standard thing with coding! thanks again