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

Rishit Shah
Rishit Shah
4,975 Points

Unexpected end of input

I am getting this error when i try to run my code "Unexpected end of input". here is my code

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

//when clicking on classes
$('.controls li').click(function(){
  //deselect sibling elements
    $(this).siblings().removeClass('selected');
  //select clicked one
  $(this).addClass('selected');
  //cache current color
  color = $('this').css("background-color");
});
// whe new color is clicked
$('#revealColorSelect').click(function(){

  changeColor();
  $('#colorSelect').toggle();
//})
  //show or hide select button

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

 }


$("input[type=range]").on("input", changeColor);

  $("#addNewColor").click(function() {
var $newColor = $("<li></li>");
  $newColor.css("background-color", $("#newColor").css("background-color") );
$(".controls ul").append($newColor);
  $newColor.click();

});
//On mouse events on the canvas
  //Draw lines
LaVaughn Haynes
LaVaughn Haynes
12,397 Points

I edited your question to display the code correctly. Don't forget to add javascript after the 3 ticks

```javascript

1 Answer

LaVaughn Haynes
LaVaughn Haynes
12,397 Points

At a glance it looks like you commented out the end of your click method. Also add a semicolon.

$('#revealColorSelect').click(function(){

  changeColor();
  $('#colorSelect').toggle();
//})
Rishit Shah
Rishit Shah
4,975 Points

Thank you. That solved my problem