7. disable the button 1


#1

I'm not sure where I'm going wrong.
Here's my code:

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


#2

@mr_optimistic,

Assuming the rest of your code is correct,
you could start by changing

else if(charactersLeft === 140); {

into

else if(charactersLeft === 140) {

For the Javascript interpreter the semi-colon-; is an End-of-Statement indicator,
causing the rest of the Statement not being interpreted.


#3

I always get stuck on the smallest things. It worked. Thank you