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

Barry Thatcher
Barry Thatcher
5,720 Points

How do I select the input?

Please could someone help answer this task. Have watched many of the videos over and over again, with no luck. Thanks.

app.js
var inputValue = document.querySelector('input');
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

Steven Parker
Steven Parker
176,604 Points

You're close, and you have correctly selected the input element.
But what the instructions are asking for is the value attribute of that element:

app.js
var inputValue = document.querySelector('input').value;