Disabled btn 2


#1
var main = function () {   
  
$('.btn').click(function() {
    var post = $('.status-box').val();
    $('<li>').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);function();

Pl check my code and suggest correction to enable me to pass the EX-8
Thanks
Rajesh


#2

Hi Rajesh,

The $('.btn').addClass('disabled'); at the end of your file needs to be moved up a line, into the main() function.
Then, you need to remove function(); on the last line.

Good luck with the rest of the course, please let me know if you've got any questions :)