7. Disable the button 1


#1

Getting the error "make sure you've declared all your variables".

var main = function() {
    
    $('.btn').click(function() {
        
        var post = $('.status-box').val();
        
        $('<li>').text(post).preparedTo('.posts');
        
        $('.status-box').val('');
        
        $('.counter').text(140);
        
        });
        
   $('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;
    $('.counter').text(charactersLeft);
    if (characterLeft < 0) {
        
        $('.btn').addClass('disabled');
        
        }
        
    else if (characterLeft === 140) {
        
        $('.btn').addClass('disabled');
        
        }
        
    else {
        
        $('.btn').removeClass('disabled');
        
        }
  });
  
  $('.btn').addClass('disabled');
    
}

$(document).ready(main);

Not sure what I'm missing here?


#2

Hi Ilmon3y,

I'm not sure if it will get you passed, but you should fix