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

CSS jQuery Basics (2014) Creating a Simple Drawing Application Perform: Part 3

I keep getting this error when I run the code uncaught type error undefined is not a function line 36

//store BG color in a variable var color = $(".selected").css("background-color");

//when clicking on controle list items $(".controls li").click(function(){ //deselect sibiling elements $(this).siblings().removeClass("selected"); //select clicked elements $(this).addClass("selected"); //cache current color here color = $(this).css("background-color"); });

//toggle the add new color window $("#revealColorSelect").click(function(){ changeColor(); $("#colorSelect").toggle(); });

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

//when sliders change $("input[type = range]").change(changeColor);

//when add new color is pressed $("#addNewColor").click(function(){ //append the color to the controls var $newColor = ("<li></li>"); $newColor.css("background-color", $("#newColor").css("background-color")); $(".controls ul").append($newColor); //select a new color $newColor.click(); });

1 Answer

Dylan Cairns
Dylan Cairns
11,191 Points

It sounds like you tried to call a function that doesn't exist or one that you misspelled on line 36. You should try re-watching the videos and restructuring your code because it looks very confusing and out of order. Also use the markdown cheatsheet when posting code so that it's properly formatted and easy to read for people to answer your question quickly. use 3 backticks ( ``` ) on separate lines before and after the code so:

<p> this is some code </p>