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) Traversing the DOM Child Traversal

Ali Sh
Ali Sh
2,026 Points

code challenge error!!!

every time i submit my code a message appear to reload the code challenge, what should i do to fix it???

app.js
const section = document.querySelector('section');
let paragraphs;
index.html
<!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>&copy; 2016</p> 
        </footer>
        <script src="app.js"></script>
    </body>
</html>

2 Answers

Adam Beer
Adam Beer
11,314 Points

Hi Ali. Use children property. "ParentNode.children". So let pharagraphs equal to "ParentNode.children"

Martin Lecke
Martin Lecke
14,385 Points

Actually there might be a bug with the challenge, i cant get passed "Check work" either. You should report it

Adam Beer
Adam Beer
11,314 Points

Replace it the "parentNode" word to the actual "parentNode" element. It is working for me.

Martin Lecke
Martin Lecke
14,385 Points

Great i was just getting Error, Reload the challenge when i tried

Adam Beer
Adam Beer
11,314 Points

Can I give you a solution to task 1?