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 trialJackson Monk
4,527 PointsWhat am I doing wrong?
I have tried every way I can think of to solve this and treehouse is still saying it's wrong. What can I do?
let inputValue = document.getElementsByTagName('a').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>
6 Answers
ianuweocrs
6,958 PointsHi ! They ask for the value of the text input, not the link, you can then retrieve it thanks to its id :
let inputValue = document.getElementById('linkName').value;
Jackson Monk
4,527 PointsThank you!
Jackson Monk
4,527 PointsWait that didn't work
ianuweocrs
6,958 PointsThat's weird, it worked for me :/ Are you sure you copied without changing anything ?
Neil McPartlin
14,662 PointsHi Jackson. I can confirm that Johan has given you the correct answer for Challenge 1, I have copy/pasted as he suggested and it has worked for me.
So with Challenge 2, you should leave the answer to Challenge 1 in place and untouched, and one solution involves adding 2 more lines of code. I will just start them here...
let inputValue = document.getElementById('linkName').value; // leave untouched
let a = // follows a similar pattern to the line above, you must examine the html to find the id.
a.textContent = // what you defined in Challenge 1.
Jackson Monk
4,527 PointsOkay thank you. Tree house is a little picky
Jackson Monk
4,527 PointsIt still won't work
Neil McPartlin
14,662 PointsPlease share with us your full answer to Challenge 2 which includes the answer to Challenge 1 as its line 1.