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 trial

JavaScript JavaScript and the DOM (Retiring) Making Changes to the DOM Modifying Elements

Christopher Jones
Christopher Jones
2,757 Points

The expectations of this exercise are rather ambiguous, in my opinion.

I get that the question wants to tie the values of the input field and the anchor tags together. Does it require a button also? This question seems to deviate from the exercise. Without additional functionality, I'm not seeing how the value is going to ever be picked up.

2 Answers

Steven Parker
Steven Parker
231,269 Points

I'm not sure what you mean by the phrase "tied together". In the challenge, the value of the input field will be copied into the anchor tag's text contents. If that's what you meant, then yes.

In task 1, the input element is identified using the ID, and the value that element is holding is assigned to the variable.

In task 2, that stored value will be copied into the anchor element.

All the work will be done in the script, no changes should be made (or additional elements added) to the HTML.

Christopher Jones
Christopher Jones
2,757 Points

Thank you for your reply. I finally figured out what was happening. It didn't like my let inputValue = document.querySelector('#linkName').value. It preferred to add the value when making the assignment. If the values are reversed at the single equal symbol (assignment), the reverse copy will happen, thus I think of them as being linked, bound, or whatever other terminology is preferred. Additionally, since the <a> element contained no text, I was unsure of the data that was supposed to be mirrored. I set it to copy the href into the input block initially. Thank you again for your help.