Oops, try again. Make sure you have defined all the variables!


#1

Whats wrong?
I can't solve this task

var main = function() {
$('.btn').click(function() {
var post = $('.status-box').val();
$('

  • ').text(post).prependTo('.posts');
            $('.status-box').val('');
            $('.counter').text('140');
        });
        $('.status-box').keyup(function() {
            var postLength = $(this).val().length;
            var characterLeft = 140 - postLength;
            $('.counter').text(characterLeft);
    
        if(charactersLeft < 0) {

    $('.btn').addClass('disabled');
    }
    else if(charactersLeft == 140) {
    $('.btn').addClass('disabled');
    }
    else {
    $('.btn').removeClass('disabled');
    }
    });

    $('.btn').addClass('disabled');

    };

    $(document).ready(main);


  • #2

    @9810,

    Have a close look at

    characterLeft