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 3

jes cahn-thompson
jes cahn-thompson
Front End Web Development Techdegree Student 6,719 Points

new color addition not consistent with rgb

any idea why the new color i'm adding turns out transparent or the same as the background (not sure which)?

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

$(".controls").on("click", "li", function(){
  color = $(this).css("background-color");


function changeColor() {
  var r = $("#red").val();
  var g = $("#green").val();
  var b = $("#blue").val();
  $("#newColor").css("background-color", "rgb(" + r + "," + g +", " + b + ")");


  var $newColor = $("<li></li>");
$newColor.css("background-color", $("newColor").css("background-color")); 
  $(".controls ul").append($newColor);
6,929 Points

Hey, I looked at it and the problem is in the function where click is binded to $("#addNewColor"). Two lines down from there in the second part of the css function you should add a # symbol in front of "newColor". So instead of $("newColor").css("background-color"), it'll read $("#newColor").css("background-color). Just a little typo error.