Disable Button


#1

Could I get some help, not sure where I am going wrong?
var main = function () {
$('.btn').click(function() {
var post = $('.status-box').val();
$('

  • ').text(post).prependTo('.posts');
    $('.status-box').val('');
    $('.counter').text("140"); // Resets the counter back to 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');
    }

    });
    };

    $(document).ready(main);


  • #2

    Hi Cfarri4436,

    Please post the error message you're getting and a link to the exercise you're on.
    Thanks!


    #3

    @cfarri4436,

    You are forgetting a dot

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