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 trialjough
12,984 Pointscode challenge help
I have a few questions about this code challenge:
My code worked but is it the proper way to solve this challenge based on the topics covered in the previous 2 lessons?
My struggle with these lessons and quizzes is not the concepts but the syntax. Did I miss the part where Gil talks about adding .value to the end of the querySelector? I feel like the quiz required concepts and syntax not covered in the videos.
Why are the questions and answers to the code challenges not accessible from the code challenge step in the course? I have to either go back to the previous video or ahead to the next one to hopefully (not always) find Q&A pertaining to the code challenge.
let inputValue = document.querySelector('input').value;
let link = document.querySelector('a#link');
link.textContent = inputValue;
<!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
Adam Beer
11,314 PointsThis is my solution:
let inputValue = document.querySelector('#linkName').value;
let anchor = document.querySelector("#link");
anchor.innerText = inputValue;
I can not answer your last question. May not be able to see the solution.