According to the condition post button should be disabled if there are no characters in the status box, but when we type a letter and delete it the post button remains enabled. . Please help with this!


var main=function(){
        var post=$('.status-box').val();
            var postLength=$(this).val().length;
            var charachtersLeft=140-postLength;
                }else if(charachtersLeft>140){



Try it by changing the mentioned ELSE-IF

else if(charachtersLeft>=140){



You may try this:

else if(charachtersLeft==140){

As your condition will only execute when variable is greater than 140 and box area is set for 140 be default, you need to check if it's equal to 140. You could also check if it's equal or greater than 140 (charachtersLeft>=140)


Hi thanks for that. But what i really need is that I can have up to 140 characters, in that case i should have my post button be disabled if the number of characters is less than 1 or greater than 140. The code works fine, but when I type a character the post button gets enabled (which is wright) but when i delete it, it should be disabled. But instead it stays enabled. So I want a code that can make it disabled when do the above...


Then give us the FULL code
you are using now......


@netpro85044 , I think you are having the same problem I had. Are you executing the first part of the exercise on disabling button post? Because the second half will disable the button after you post something.

1) When you load the page and type nothing in text area, button is disabled.
2) If you type and erase everything without pressing the button, button returns to disabled status.
2) But, if you type and post, the next post you are able to post it blank.

If this is your case, please see my post below:

Otherwise, please show us full code with the evidence of your issue.