Oops, try again. Remember to update the '.counter' to show how many characters are left


#1

$('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;
    $('.counter').text(charactersLeft);
  });
}

#2

Hi Alpana,

Please post a link to the exercise you're on and your full code so we can help you :slight_smile:


#3

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

var main = function() {
 $('.btn').click(function() {
     var post = $('.status-box').val();
    $('<li>').text(post).prependTo('.posts');
    $('.status-box').val('');
 }
}
    
});

$('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;
    $('.counter').text(charactersLeft);
  });
}

Oops, try again. Remember to update the '.counter' to show how many characters are left.


#4

@alpanamishra Try adding this line at the very bottom of your code:

$(document).ready(main);