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 Making Changes to the DOM Modifying Elements

Rashad Nelson
Rashad Nelson
5,653 Points

Please review my code

I am trying both querySelector and getElementById but they both give the same error message. Am i doing something wrong or just over looking something.

const inputValue = document.querySelector('input');
const inputValue = document.getElementById('linkText')
<!DOCTYPE html>
      <title>DOM Manipulation</title>
    <link rel="stylesheet" href="style.css" />
      <div id="content">
        <label for="linkText">Link Text:</label>
        <input type="text" id="linkText" value="sample text">
        <p class="info"></p>
    <script src="app.js"></script>

1 Answer

Steven Parker
Steven Parker
217,519 Points

You can only declare a const value one time.

You were pretty close on the first one, you did select the right element. But the instructions say to assign the value of the element instead of the element itself.

Rashad Nelson
Rashad Nelson
5,653 Points

Hello i was wondering if you review personal projects. i am a beginner so i am working on a gym website. At the point now i am just getting the website look up. I wanted to see what i can do better and what i am doing good. After i will start to add JS and ReactJS code to make it a move exciting. I have linked my GIT HUB account and will supply more info on my repository. Just wanted to see if anyone at TH staff does reviews and/or if the community does.

Thank you

Steven Parker
Steven Parker
217,519 Points

I think the forum is mostly students helping each other with problems, but you could post a link in case someone might want to take a look.

If the original issue in this question had been resolved, you can mark the question solved by choosing a "best answer".
And happy coding!