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 trialJason Peay
16,515 PointsHow to select a parent node and store it in a constantDiv?
I'm having trouble finding the answer to a quiz question. Here is the question: In the code below, the constant div contains a reference to a DOM element. Select its parent node and store that in the constant parentOfDiv
const div = document.querySelector('div'); const parentOfDiv =
4 Answers
Samantha Fluke
7,163 PointsI got the right answer with: const parentOfDiv = div.parentNode;
Harshit Singh
6,280 PointsIn the code below, the constant div contains a reference to a DOM element. Select its parent node and store that in the constant parentOfDiv const div = document.querySelector('div'); const parentOfDiv =
The parentNode property of div can access its parent. what will be the parent node for constantDiv plz help me
Jonathan Rhodes
8,086 Pointsconst parentOfDiv = div.parentNode;
Jonathan Rhodes
8,086 PointsThe parentNode property of div can access its parent.
Przemyslaw Chmiel
13,532 PointsCould someone Explain me, how its really works? Thanks for everyone hlep.