Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Jason 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.