Disable button 2


#1

Can anyone tell me what is wrong with my code??

var main = function() {
    $('.btn').click(function() {
        var post =$('status-box').val();
        $('<li>').text(post).prepentTo('.posts');
        $('.status-box').val('');  
        $('.btn').addClass('disabled');
        $('.counter').text(140);
    });
    
    $('.status-box').keyup(function(){
    var postLength = $(this).val().length;
    var charactersLeft == 140 - postLength;
    $('.counter').text(charactersLeft);
        
    
    if(charactersLeft < 0) {
        $('.btn').addClass('disabled');
    }
    else if(characterLeft == 140) {
         $('.btn').addClass('disabled');
    }
    else {
        $('.btn').removeClass('disabled');
    }
    });
    
       $('.btn').addClass('disabled');

#2

@unknowntobeelz,

Your code is missing a closing-curly-bracket-}
with which you close the main function
and a
$(document).ready(main);


#3

- - - - - - - - - - - - S t a t u s U p d at e - - - - - - - - - -

= = = = = = = D ocument O bject M odel = = = = =

                     2html
                       |
        |--------------+-----------|
      3head                      8body
        |                          |
  |-----|+----|                    |
  |     |     |                    |
4link 5link 6link                9div
                                   |
  |----------------|---------------+---|--------------|
  |                |                   |              |
10form           15div(.button-group 20ul         24script(2x)
   |                |  .pull-right)    (.posts)    25script
11div(.form-group)  |
   |                |
12textarea          |
    (.form-control  |
    .status-box)    |
                    |
         |----------+----|
       16p(.counter)   17a(.btn
         |               | .btn-primary)
        text            text
        node            node
# status update

class-name disabled....

Where is style for that class?
Styling is an Attribute of an Element.
In the style.css-file
I was wondering where is disabled class.

The "disabled" class-name is -set- by you via the Javascript app.js
as an additional class Attribute of
the a-Element, which you identify by the class-name "btn"

The sole purpose of the "disabled" class-name
is to have an indication, if the
identified by the class-name "status-box"
has 1 or more characters -set-

If the a-Element has the _"disabled" class-name as a class Attribute set,
the Button-Functionality is Blocked.
( you use the Bootstrap-functionality )