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

Barry Thatcher
Barry Thatcher
8,874 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.

var inputValue = document.querySelector('input');
<!DOCTYPE html>
        <title>DOM Manipulation</title>
    <link rel="stylesheet" href="style.css" />
        <div id="content">
            <label>Link Name:</label>
            <input type="text" id="linkName">
            <a id="link" href=""></a>
        <script src="app.js"></script>

1 Answer

Steven Parker
Steven Parker
195,597 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:

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