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

John Lambert
John Lambert
2,433 Points

JavaScript and the DOM challenge task 1 of 2 is not working. var inputValue = document.getElementById('linkName');

var inputValue = document.getElementById('linkName'); is the correct way to call the element but it still says that it is wrong when I check my answer. Is there a technical issue with this exercise? I verified with 3 separate sources that this is how it's done.

app.js
var inputValue = document.getElementById('linkName');
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <div id="content">
            <label>Link Name:</label>
            <input type="text" id="linkName">
            <a id="link" href="https://teamtreehouse.com"></a>
        </div>
        <script src="app.js"></script>
    </body>
</html>
Jess W
Jess W
9,490 Points

If I'm looking at the right question, it's asking you for the value of what's in the input field. You're correctly selecting the element, but you need to get at the value.

I got tripped up on this too, and think it could use a better error message.

John Lambert
John Lambert
2,433 Points

Thank you so much Jess W. I was struggling with this for a bit. I don't know how I overlooked that.

1 Answer

Jess W
Jess W
9,490 Points

You're welcome! :)