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

Kinkaid Nolen
Kinkaid Nolen
4,859 Points

What am I missing?

It's saying the value of the input element is not being selected. What's wrong?

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>

2 Answers

Steven Parker
Steven Parker
176,543 Points

This code is currently selecting the input element itself, but the challenge wants you to select the value (the ".value" attribute) of that element instead.

var inputValue = document.getElementById("linkName").value;
Dmitry Polyakov
Dmitry Polyakov
4,410 Points

You have to grab the value, so you need to append .value at the end

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