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 trialMahfuzur Rahman
3,204 Pointsdifficulty in understanding and passing the second task
let inputValue=document.getElementById('linkName');
let aTag=document.getElementById('link'); inputValue=aTag;
// I understand that here I am replacing the inputValue with the aTag.
let inputValue=document.getElementById('link').value;
//let aTag=document.getElementById('link').value;
//inputValue=aTag;
<!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
Matthew Long
28,407 PointsLooks like you've almost got the first challenge. However, you're not selecting the input element, you're selecting the anchor element. The ID associated with the input element is linkName
, not link
.
let inputValue = document.getElementById('linkName').value;
The second challenge wants you to use the value from the input element that you selected and stored in the variable inputValue
. Make that the text, or innerHTML
of the anchor tag that you had previously selected in your original solution attempt.
document.getElementById('link').innerHTML = inputValue;