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!
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 trial
Angelica Islas4,082 Points
How do I solve this problem?
Select the <input> element with the ID linkName and store its value in the variable inputValue.
var inputValue= "LinkName"
<!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>
a few things to do here before you pass this code challenge:
1) You have to first SELECT the id element, for example with
document.getElementById(). But pay close attention to the exact writing of the id name. It is NOT "LinkName" but "linkName" (so it starts with a lowercase "l").
2) Once you selected the id you are asked to get the value of this element. This is easily done by just adding
.value to the end of the selector you wrote.
Do you feel confident in selecting DOM elements yet? If not I would highly highly reccomend going over the basics of selecting DOM elements quite a few times (that's stage 2 of that course). It is really tough at the beginning and it is nearly impossible to grasp it all the first time. I remember I had a really tough time with the DOM concepts when I first learned it. And it's really valuable to repeat the basics of it quite a few times (until you feel comfortable).
Blessings from Berlin and happy java-scripting, Nils
PS: If my answer helped you or solved your issues, please upvote my answer and/or mark it as "Best answer" (so people browsing the community forum know your issue is solved)