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 trialEd Bundy
5,408 PointsPerhaps someone can clarify the challenge question, as I suspect it is poorly worded
"Store the value of the input element with the id link in the variable inputValue. "
Okay, am I misunderstanding something? There is no input element with an id= link.
Is this actually meaning to say: "Store the value "link" into the id attribute of the input element? " (ie, change it)
If so, I'm not having success yet doing so, but I don't want to kill hours trying to solve a challenge that isn't even intended here.
Perhaps someone can offer another wording for this challenge that makes sense. I don't consider an anchor an input element. Am I wrong?
8 Answers
andren
28,558 PointsThe id
named is indeed wrong. The challenge text is meant to read like this:
Store the value of the input element with the id linkName in the variable inputValue.
The HTML does have an <input>
element with that id. The challenge wants you to target that element, pull out the value stored within it and assign it to the variable called inputValue
.
John Greer
Courses Plus Student 759 PointsWish I saw this an hour ago. Thanks for clarifying this. Treehouse needs to proofread.
Ed Bundy
5,408 PointsThanks for saving me from a huge waste of time and undue agitation. My condolences to the rest that follow and don't see this question first.. :)
Rod R
3,050 Pointslet inputValue = document.getElementById('linkName').value; << finally worked
Desiree Dixon
8,203 PointsThanks!
Mick Webb
2,247 PointsThis is what I put
let inputValue = document.getElementById("linkName");
But get THIS error:
You selected the element, but have not gotten the value.
Please help, thanks
John Greer
Courses Plus Student 759 PointsYou have the right element, as the input element clearly has the id linkName, but you didn't specify the value, accessed by adding ".value" to the end of your line of code. Your code should read... let inputValue=document.getElementById("linkName").value;
Philipp Henk
12,494 PointsGuys, I got stuck with the second part of the challenge. Could someone please explain, how it should be done.
Challenge Task 2 of 2 Set the text content of the a tag to be the value stored in the variable inputValue.
that's my code from the first challenge so far: let inputValue = document.getElementById('linkName').value;
I have literally no clue how to proceed...
Krystian Kochanski
1,845 PointsI am stuck on the second task as well.
Jesse Vorvick
6,047 PointsMine was:
const inputValue = document.getElementById('linkName').value;
document.getElementById('link').textContent = inputValue;
Jesse Vorvick
6,047 PointsMine:
const linkName = document.getElementById('linkName');
const inputValue = linkName.value;
I think I like Rod's more though.
Vlad Popa
1,995 PointsThe javascript and the dom course is awful. I haven't had so many problems with any of the other javascript courses
Ivan Kazakov
Courses Plus Student 43,317 PointsIvan Kazakov
Courses Plus Student 43,317 PointsHey Ed, as far as I remember, there's a typo: just find the correct
id
in the accompanying html and use it instead oflink
(don't remember what it is exactly)