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

Gandi Gandalf
Gandi Gandalf
363 Points

Code doesn't work. I don't know what to do :(

It shouldn't be a hard task, but I don't know how to do it...

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

1 Answer

Dmitry Polyakov
Dmitry Polyakov
4,946 Points

Hey.

  1. If you use querySelector you need to specify the type of a selector in parenthesis. For id in this case you need to add a hash sign.

  2. You are looking for an input value. So you need to append .value at the end

var inputValue = document.querySelector('#linkName').value;