Interactive Website: Status Update


#1


https://www.codecademy.com/courses/web-beginner-en-hk5qh/0/7?content_from=make-an-interactive-website%3Ajquery-dom-manipulation#

Oops, try again. Remember to add the line $('.btn').addClass('disabled'); outside your keyup event handler


var main = function() {
  $('.btn').click(function() {
    var post = $('.status-box').val();
    $('<li>').text(post).prependTo('.posts');
    $('.status-box').val('');
    $('.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(charactersLeft === 140) {
          $('.btn').removeClass('disabled);
      }
      else {
          $('.btn').removeClass('disabled');
     }
});

$('.btn').addClass('disabled');
$(document).ready(main);


#2

Hi this line

 $('.btn').addClass('disabled);

you ddin't clsoe the string around disable the same in the else if statement

$('.btn').removeClass('disabled);

then add a } for closing the compare function

..
$('.btn').addClass('disabled');3
#add it here
$(document).ready(main);

#3

What do you mean? Could you maybe show me and example?


#4

Wll this line

 $('.btn').addClass('disabled);

you just need to add the ' to close the string like that

 $('.btn').addClass('disabled');

DO you see the diff?
then here

..
$('.btn').addClass('disabled');
# you should add }   here to close the main function
$(document).ready(main);

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.