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 trialCarlos Marin
2,675 PointsThe anchor tag's text has not been selected.
I keeping having issues with selecting things in the DOM. Would someone be kind enough to evaluate why this is not working? and refer to me a link/video of where I can improve my skills?
let inputValue = linkName.value;
inputValue.textContent = document.getElementById('link').value;
<!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
Adam Beer
11,314 PointsIn the first row, you forgot use the document.getElementById() selector.
let inputValue = document.getElementById('linkName').value;
document.getElementById('link').textContent = inputValue;
Carlos Marin
2,675 PointsIf anyone else has stubbled upon this post, and is wondering the same thing. I recommend re-doing the DOM selection courses, and practicing the challenges multiple times. There are different methods to select elements, and it helps to do the challenges with different methods. Good luck! :)
Carlos Marin
2,675 PointsCarlos Marin
2,675 Points"Important: In each task of this code challenge, the code you write should be added to the code from the previous task." this is the 2nd step of the challenge and the 1st line of code worked for the first step.
Carlos Marin
2,675 PointsCarlos Marin
2,675 PointsThe 2nd line you provided, was the solution to the 2nd step, but I am still puzzled to as why my code did not pass.
Adam Beer
11,314 PointsAdam Beer
11,314 PointsThat's just a tip I think. That is based on the previous task. I do not even know why they write it out. But if you write the whole code, I don't think it's wrong.