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 Foundations Variables Basics

mickey Odunikan
mickey Odunikan
4,983 Points

I don't know what they are asking me to do

In the myscript.js file, on line 6, get the element by the id of "container"

<!DOCTYPE html>
<html lang="en">
    <title> JavaScript Foundations: Variables</title>
      html {
        background: #FAFAFA;
        font-family: sans-serif;
    <h1 id="title">JavaScript Foundations</h1>
    <h2>Variables: Basics</h2>

    <div id="container">
      This is a div with the id of "container"
<script src="myscript.js"></script>
/* JavaScript Foundations: Variables */

var bgColor = "blue";
var textColor = "#ff9933";

var container = document.getElementById('title');
container.style.background = bgColor;
container.style.color = textColor;

1 Answer

As the line exists you're getting the variable by the id of "title", not "container".