I’m trying to set the text content of the a element as the input Value but using reassignment.
var inputId= document.getElementById('linkName'); var inputValue = inputId.value; inputValue = document.getElementById('link').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>
Brandon WhiteTreehouse Moderator
Great job on completing part one of the challenge.
If you look at the third line you've written you'll notice that you've called textContent on the anchor element with the id of link. Now all you have to do is set the value of the of the anchor elements textContent to something. In this case, what you want to set the value to is the inputValue variable declared on line two.
In addition, on the third line you're currently changing the value of what's stored in the inputValue declared on line two the the textContent of the anchor element with the id of link, which is nothing. So while you're setting the value of textContent for the anchor element with the id of link, you will also not store it to a variable (or at least you don't want to store it in the inputValue variable).
Keep at it coder!
Happy .11,409 Points
This stumped me for a while, but it's simpler than it looks.
You don't need to change the value of inputValue after it's been set, nor create a new variable, you need to GET the existing element('link') and SET textContent to inputValue
I hope that makes a bit more sense when trying to code your answer.