Lite Brite Project


I am in desperate need of some assistance regarding my code below for the Lite Brite Project. Could someone please review this and tell me my mistakes.

function main() {
  var colorClass = '';
  $('.select-color').on('click', function() { //this is the click function
    var selectedColor = $(this).attr('class'); //this saves the selected color
    switch(selectedColor) {
      case 'select-color blue not-selected':
        colorClass = 'blue';
      case 'select-color yellow not-selected':
        colorClass = 'yellow';
      case 'select-color orange not-selected':
        colorClass = 'orange';
  $(this).removeClass('not-selected'); // this makes the buttons light up once selected
    $(this).siblings().addClass('not-selected');    // this make sure all selected colors won't stay lit
  $('.box').on('click', function() {  // this is click function for boxes 
    $(this).toggleClass(colorClass);  // selects the box clicked and picks a color
  $('.toggle-blink').on('click', function() {
    if(colorClass) {
      setInterval(function() {
        $(', .box.yellow,').toggleClass('blink');
      }, 350);
$(document).ready(main); //calls back function main


Please post the URL to this project so we can test your code.