Hello to everyone this is my code but I don't know what's wrong please help me


#1

$('.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');
}

it says:
Remember to add the line $('.btn').addClass('disabled'); outside your keyup event handler


#2

Hi @wisemanmukhtar,

addClass(), removeClass(), and toggleClass() don't use a dot (.) before the class name. So that line should look like this instead:

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

:slightly_smiling:


#3

ww Zystvan, actually you are right thank you :smile:


#4