Exercise 8,Disable btn 2


#1

Thanks for the quick response but not passed.Below giving the latest code.I have not understood your message.If possible kindly give full code.I shall be
highly obliged. var main = function () {
$('.btn').click(function() {
var post = $('.status-box').val();
$('

  • ').text(post).prependTo('.posts');
    $('.status-box').val('');
    $('.counter').text('140');
    $('.btn').addClass('disabled');
    });
    $('.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').addClass('disabled');}
        
     
    $('.btn').addClass('disabled');
    });
    $(document).ready(main);

  • #2

    The opening curly brace ({) before else belongs right after it, before $('.btn')..., and then you need to close main() with a closing curly brace (}) right before the last line.