Need help on #7 - "Remember to add the line $('.btn').addClass('disabled')" error


#1

I still can't figure out what I did wrong as code says ."Oops, try again. Remember to add the line $('.btn').addClass('disabled'); outside your keyup event handler"

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 charactersLeft = (140 - postLength);
    $('.counter').text(charactersLeft);

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

    });

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

    $(document).ready(main);


  • 7.Disabled the button 1
    #2

    @meggiie123,

    1

    Have a close look at

    $(.'btn')

    2

    You are forgetting 1 closing-curly-bracket-} with which you close the =main= FUNCTION-BODY


    #3

    thank you very much solved it, :slightly_smiling: Thanks a lot!