Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript and the DOM Making Changes to the DOM Modifying Elements

Jospeh Quintiliano
Jospeh Quintiliano
3,408 Points

inputValue = document.querySelector('.info').textContent is wrong????

the second task made no sense, i wrote

inputValue = document.querySelector('.info').textContent; //this said i was wrong but these lessons never went over that it needs to read from left to write or right to left...i thought x=y and y=x was the same????

it only took the following code, why is that??

document.querySelector('.info').textContent = inputValue;

var inputValue = document.querySelector('input').value;
<!DOCTYPE html>
      <title>DOM Manipulation</title>
    <link rel="stylesheet" href="style.css" />
      <div id="content">
        <label for="linkText">Link Text:</label>
        <input type="text" id="linkText" value="sample text">
        <p class="info"></p>
    <script src="app.js"></script>

2 Answers

Steven Parker
Steven Parker
216,033 Points

The target of the assignment (the thing being changed) is always the term on the left of the = operator.

This wouldn't be covered in this specialty course, it would likely be in a preliminary course like JavaScript Basics.

Jospeh Quintiliano
Jospeh Quintiliano
3,408 Points

oh wait, i think its because im CHANGING the .textContent to inputValue, not changing inputValue to the textContent since there is no text content to begin with correct???