"Number of characters exceeded!"- character counts negative numbers also


#1



$('.status-box').keyup(function() {
        var postLength = $(this).val().length;
        var charactersLeft = 140 - postLength;
        $('.counter').text(charactersLeft);
        
        if(charactersLeft < 0) {
            $('.btn').addClass('.disabled');
            $('.counter').text(0);
            alert("Number of characters lenght exceeded!!");
        }
        else if(charactersLeft == 140) {
            $('.btn').addClass('.disabled');
        }
        else {
            $('.btn').removeClass('disabled');
        }
    });


#2

@sudheersud,
And why are you using


#3

I know it's not the best solution to it but, I am replacing negative numbers with 0, so we don't see negative numbers.