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

I don't Know How to Solve This

I don't understand how can I use getElementById, and select input?

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>

1 Answer

Romain Gaget
Romain Gaget
24,448 Points

You'll need to add the value property at the end to get an input field value:

var inputValue = document.getElementById('linkName').value;