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

The question is erred. Assigning both question 1 and 2 to value 'inputValue'

The question is erred. Assigning both question 1 and 2 to value 'inputValue'

app.js
var inputValue = document.getElementById('linkName').value;
inputValue = document.getElementById('link').textContent;
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

rabin
seal-mask
.a{fill-rule:evenodd;}techdegree
rabin
Front End Web Development Techdegree Student 15,247 Points

Hey Kyle Law,

For the second part, you need to create a new variable, select <a> element and then display a value received from inputValue variable using a textContent property.

Here's the final code:

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

Hope this helps!