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 jQuery Basics (2014) Creating a Simple Drawing Application Perform: Part 5

Line color does not start off red.

Everything seems to be working fine; however, when I first test the page, the initial drawing color is black. The red circle has the white ring around it as if it is selected, but I have to click on it first to actually draw in red. Shouldn't it start off with red like in the video? https://w.trhou.se/p94rh24vff

1 Answer

On line 3 of your app.js you have the following:

var color = $("selected").css("background-color");

You're missing the dot/period to make it a class selector, so it's looking for a HTML tag/element selected instead.

Update to the following, save the file, refresh the preview with Ctrl+Shift+R or Ctrl+F5, and it should work:

var color = $(".selected").css("background-color");

Thanks! That did it!