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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Selection Review

In the previous quiz it ask how to select the body element on a html page using document.getElementsByTagName ?

So my answer was to use document.getElementsByTagName('body'); and store the tag back into the variable in the previous quiz. It said I got it wrong and didn't give me the correct answer. What is the right answer?

1 Answer

Tri Pham
Tri Pham
18,671 Points

Read the hint: (Hint: Don't forget that this method returns a collection, not a single element.). You would do it the same way you get the first item of an array.

I see Tri, thanks man. I was select the body tag right, just wasn't telling the quiz it was the first one [0]. Thanks for the help I never go to the next section unless I get 100 on quiz so was stressing me out.