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 trialOSMAN KAMARA
Front End Web Development Techdegree Graduate 33,856 PointsI'm stuck on challenge Task 2 of 2..Help!
const input = document.querySelector('input');
let inputValue = input.value;
let tag = document.querySelector('a');
inputValue = tag.textContent;
<!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>
4 Answers
Jawann Carmona
19,556 PointsHey, the wording for this question might be confusing. It's asking for you to make the textContent of the tag equal the value of the inputValue variable.
So it should look like this:
const input = document.querySelector('input');
let inputValue = input.value;
let tag = document.querySelector('a');
tag.textContent = inputValue;
Before, you were actually changing the value of inputValue to be whatever the textContent of 'a' is.
Kristian Woods
23,414 Pointslet inputValue = document.querySelector('#linkName').value;
let link = document.querySelector('#link');
link.textContent = inputValue;
I found that this worked for me
OSMAN KAMARA
Front End Web Development Techdegree Graduate 33,856 PointsThanks a bunch!
OSMAN KAMARA
Front End Web Development Techdegree Graduate 33,856 PointsWow, that was an awesome breakdown, thanks man!
Fabian Pijpers
Courses Plus Student 41,372 PointsThanks Mr Woods,
Your answer made it happen and told me clearly where and how i went wrong. I missed adding .value at the end of line.
OSMAN KAMARA
Front End Web Development Techdegree Graduate 33,856 PointsOSMAN KAMARA
Front End Web Development Techdegree Graduate 33,856 PointsWow, that was an awesome breakdown, thanks man!