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 trialKatie Jordan
7,842 PointsWhy Wont This Work...?
let linkName = document.getElementById('linkName').value() linkName.textConent('a')
This is my attempt at the answer but its not working... can someone point me in the right direction please?
<!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>
let linkName = document.getElementById('linkName').value
1 Answer
Brian Jensen
Treehouse StaffYou have to reassign the output of "a" back into the linkName variable.
This is how I solved it:
let linkName = document.querySelector('input').value;
document.getElementById('link').textContent = linkName;
john larson
16,594 Pointsjohn larson
16,594 PointsHey Brian, I've been grinding my teeth thinking about learning the new changes to js, But that snipet of code you have there looks pretty readable. How do you like ecma6?
Brian Jensen
Treehouse StaffBrian Jensen
Treehouse StaffI just started learning JS in April, so I pretty much only know the new syntax lol. I am lazy and really hate vanilla JS though. I much prefer jQuery.