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

Siddharth Pandey
Siddharth Pandey
4,184 Points

Why doesn't this work:

Code: I typed in var inputValue = document.getElementById('linkName');

But the program still says I am wrong.

app.js
var inputValue = document.getElementById('linkName');
return inputValue;
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>

1 Answer

They want you to get the value of what is stored in the input;

var inputValue = document.getElementById('linkName').value;
Siddharth Pandey
Siddharth Pandey
4,184 Points

Thanks, yeah, now I see where I was going wrong.