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

Zenzi Ali
PLUS
Zenzi Ali
Courses Plus Student 2,412 Points

I'm looking for some general help

I've been working on the Full Stack track and hit a roadblock. I'm unable to successfully manipulate the Dom. I've been stuck in this section for over a week. I watch a section, attempt an exercise or quiz, and fail. I'm truly lost. I've been in a failure loop! The only reason I've completed any sections at all is that others have helped me. I don't even know what I'm not getting or what to do. Has this happened to anyone else? What should I try now?

app.js
var inputValue = input.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>

1 Answer

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Zenzi.

Itโ€™s unfortunate youโ€™re feeling like this. We all go through these moments so know that youโ€™re not alone on that score.

Manipulating the DOM works in stages. You first select the element in JavaScript and then make the code listen for something called an event so it can then perform an action on it.

Just keep going back through the course which will give you all the information you need about how to select elements and listen for actions so the DOM can be changed.

Hint... look for things like document.getElementById andaddEventListener to get you started. These are the core methods of DOM scripting.