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

Stellah Avanthi
Stellah Avanthi
Full Stack JavaScript Techdegree Student 5,934 Points

Select the <input> element with the ID linkName and store its value in the variable inputValue.

The quiz does not evaluate my answer correctly. Not able to get what else needs to be done.

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

Dimitar Dimitrov
Dimitar Dimitrov
10,298 Points

linkName is a input element so you can store its value(text, number etc ) with .value

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