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 trialMitchell Wintrow
4,380 PointsHow do I solve this text content challenge? I don't even understand what it's asking of me... The video doesn't help...
What is this challenge even asking me to do? I rewatched the video before it 4 times, and found nothing in it that helps me with this particular challenge. I've tried all kinds of different ways to do this, but I've had no luck whatsoever and the challenge doesn't really provide useful information about what I'm doing wrong. I get that it's a challenge, but isn't the point to learn, and how do I learn when it doesn't guide me through what I'm doing wrong? The video doesn't say and neither does the feedback, so I'm hoping the community on here will be able to help me! It barely touched on 'textContent' and didn't explain how to do what this challenge is asking for. I'm sure I'll probably feel stupid when I get the solution, but seriously I've been working on this for an hour and a half and it's really frustrating because so far everything else in this course has been incredible and I've been able to follow along and figure it out. I have never had this much trouble with any other challenges in this entire course so far, I think this one just doesn't explain what is being asked well enough and the video doesn't explain how to do it clearly, but it could be that I'm missing something too. Thanks for your help!
const myInput = document.querySelector('input');
let inputValue = myInput.value;
document.querySelector('p .info').textContent = myInput.value
<!DOCTYPE html>
<html>
<head>
<title>DOM Manipulation</title>
</head>
<link rel="stylesheet" href="style.css" />
<body>
<div id="content">
<label for="linkText">Link Text:</label>
<input type="text" id="linkText" value="sample text">
<p class="info"></p>
</div>
<script src="app.js"></script>
</body>
</html>
1 Answer
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsYou almost got it correct; you just have to remove the p
and the space from document.querySelector('p .info').textContent = myInput.value;
. You don't need it since there's only one element with the info
class.
Mitchell Wintrow
4,380 PointsMitchell Wintrow
4,380 PointsThank you so much Joseph!!! You have been a huge help and you're correct, it definitely worked. I knew I would feel stupid afterward haha, it was such a simple fix. It's hilarious much much trouble such small things in programming can give us.