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.

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,313 Points

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

Martin Lecke
Martin Lecke
14,370 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,313 Points

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

Martin Lecke
Martin Lecke
14,370 Points

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

Adam Beer
Adam Beer
11,313 Points

Can I give you a solution to task 1?