Interactive Website: Status Update. disable the button


This is my code:

var main = function() {
$('.btn').click(function() {
var post = $('.statusbox').val();

  • ').text(post).prependTo('.posts');

    $('.status-box').keyup(function() {
    var postLength = $(this).val().length();
    var charactersleft = 140 - postLength;

    if (charactersleft < 0) {

    else if(charactersleft === 140) {

    else {



    This is the error that i get when i try to submit it:
    Oops, try again.
    Remember to add the line $('.btn').addClass('disabled'); outside your keyup event handler

    Can someone help me with this problem?

  • #2

    The problem should be corrected when you close your main function at the end and not at the beginning of the script. Close it just before the line $(document).ready(main);


    one thing I observed instead of btn, .btn should be use