Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript and the DOM (Retiring) Making Changes to the DOM Modifying Elements

Preston Hill
Preston Hill
5,766 Points

Can't get the second part of the challenge. just don't understand.

I think I am just burned out for today, but I cant seem to understand how to do the second part of this challenge.

app.js
let inputValue = linkName.value;
const linkName = 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

Balazs Peak
Balazs Peak
46,160 Points

You tried to create a linkName variable, but that is just the ID from the HTML, which needs to be put into the inputValue variable. Hope this helps!

The solution turned out to be:

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

Balazs Peak
Balazs Peak
46,160 Points

And also, in your first row, you handled linkValue as a local variable. It is an ID from the HTML which needs to be reached with the getElementById function. Much love!