Whats wrong with my code on 7/9?


#1

What's wrong with my code? I did what it told me to do.

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

#2

Hi John,

You're checking the wrong variable name in your if and else if statements :slightly_smiling:


#3

Thanks. I've been stuck on this for a few minutes trying to figure out.