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

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.

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

1 Answer

Steven Parker
Steven Parker
231,248 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.

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
231,248 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.

Happy coding!