5. Count characters left


I keep getting this message
‘Oops, try again.
Remember to update the ‘.counter’ to show how many characters are left’
But I cant see whats wrong, can you please help me?

var main = function() {
('.btn').click(function() { var post = (’.status-box’).val();

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


Before getting ready your main function, end your variable main with a semicolon. Look also at this part;

Is there an error to ('.posts')where you put an additional s?


@miniapple8888 Sorry, but no - both of your suggestions are incorrect.

@christina.bruun Your code is fine, please try refreshing the page or switching browsers.


It looks right with one exception: Under var post = $('.status-box).val(); you need to create a new ‘li’ attribute to append the new message in. The next line should look like $('<li>').text(post).prependTo('.posts');


A post was split to a new topic: My code doesn’t work on exercise 5