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

Not sure what is happening here. I would appreciate help!

let aLink = document.querySelector('a#link'); aLink.textContext = inputValue.value;

app.js
let inputValue = document.querySelector('input#linkName').value;
let aLink = document.querySelector('a#link');
aLink.textContext = inputValue.value; 
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>

3 Answers

inputValue already is the value so you don't need inputValue.value. Try task 2 in one line of code without the variable.

kevin curtis
kevin curtis
15,287 Points

Hey Chuck,

InputValue is already assigned as a variable in that challenge so you can remove the 'let,' it doesn't need to be assigned a second time.

Also, as Kris said, drop the .value from inputValue because you already got that value on the previous line. And lastly, you're also using textContext when it should be textContent.

So you should end up with something like this:

inputValue = document.querySelector('input#linkName').value;

document.querySelector('a#link').textContent = inputValue; 

Thanks guys! I found all this and fixed it. I couldn't figure out a way to remove my question. I appreciate your help!

kevin curtis
kevin curtis
15,287 Points

No worries Chuck. Leaving the question there could be beneficial to someone else having the same problem, so it's all good.

that is true!