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

Keytron Brown
Keytron Brown
12,032 Points

Next, set the text content of the <p> element with the class info to the value stored in inputValue.

This challenge doesn't give clear directions or any hints. Could I have an answer for reference please?

let inputValue = document.querySelector('input');

inputValue = inputValue.value;

let word = document.querySelector('p');

inputValue = Value.className;
<!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>

1 Answer

In the challenge instructions, the words "text content" link to a page about the text content property of a Node, which includes syntax examples.

let word = document.querySelector('p');
word.textContent = inputValue;