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 trialAlan Rudziński
4,244 PointsNot passing tests
Why i am not passing tests even though all paragraphs are blue as mentioned in the task?
var section = document.querySelector('section');
var paragraphs = section.children;
var footer = document.querySelector('footer');
var footerPara = footer.children;
for (let i = 0; i < paragraphs.length; i++) {
paragraphs[i].style.backgroundColor = 'blue';
}
footerPara[0].style.backgroundColor = 'blue';
<!DOCTYPE html>
<html>
<head>
<title>Child Traversal</title>
</head>
<body>
<section>
<p>This is the first paragraph</p>
<p>This is a slightly longer, second paragraph</p>
<p>Shorter, last paragraph</p>
</section>
<footer>
<p>© 2019</p>
</footer>
<script src="app.js"></script>
</body>
</html>
1 Answer
Eric M
11,546 PointsHi Alan,
The bummer message for the code you posted should read: Bummer: Make sure to change the text color of all paragraphs to blue.
Note that it says text color and your code changes the background color.
The instruction to "change the color of each child paragraph to blue" could be clearer and say "change the text color of each child paragraph to blue".
I'm sure with this info you'll be able to get it :)
Cheers,
Eric
Eric M
11,546 PointsAh, bot.net, I didn't see your comment before answering, just that the post had no answers, you're absolutely right of course!
<noob />
17,062 Points<noob />
17,062 Pointsin task 2 ur being asked only yo change the color of the p tags not the background.
so change the code to :
paragraphs[i].style.color = 'blue';