JavaScript JavaScript and the DOM Making Changes to the DOM Modifying Elements

John Lambert
John Lambert
1,166 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,476 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
1,166 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,476 Points

You're welcome! :)