Lite Brite Project Won't Light Up


#1

I've gotten to step 10, and none of the written colours or boxes will light up when I click on them. I feel like I'm missing something fairly obvious! Could someone please review my code and let me know where I'm going wrong?

function main(){
  var colorClass = '';
  $('.select-color').on('click', function(){
    var selectedColor = $(this).attr('class');
    switch (selectedColor) {
      case 'select-color cyan not-selected':
        colorClass = 'cyan';
        break;
      case 'select-color yellow not-selected':
        colorClass = 'yellow';
        break;
      case 'select-color magenta not-selected':
        colorClass = 'magenta';
        break;
    }
    $(this).removeCLass('not-selected');
    $(this).siblings().addClass('not-selected');
  });
 $('.box').on('click', function(){
   $(this).toggleClass(colorClass);
 });
  
}

$(document).ready(main);

Thank you!


#2

Please remember to include a link to the exercise so we can get to it without having to dig around, aimlessly. Thanks.


#3

https://www.codecademy.com/en/courses/learn-javascript/projects/lite-brite


#4

It took forever to spot the error in that line.


#5

Thank you! That solved it


#6

A post was split to a new topic: Lite Brite won't light up