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

Laura Arias
Laura Arias
4,620 Points

it says I am selecting the wrong element

I am getting the element through its id. It says I am wrong

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>

2 Answers

Clayton Perszyk
MOD
Clayton Perszyk
Treehouse Moderator 46,075 Points

You need the elements value. you can access it with .value.