Step 5: count characters left


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

here is my code

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


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

$(document).ready(main) ;


Hi Mohamed,

You should probably change your username right now, since your email address is currently visible

Your code worked for me, both in passing the exercise and in functioning properly.
Have you tried refreshing the page or switching browsers? That might 'fix' the issue :)


I tried Safari instead of Chrome and nothing changed.


Still works for me, on Firefox 44.0a2 on Linux.
Is the code you posted above your complete code?
And also, is line 4 exactly like this?



yea it's the complete code and yes line 4 is exactly like that.


4 posts were split to a new topic: Exercise 5, "Remember to update the '.counter' to show how many characters are left" error


The only thing that you need to change with your code is you need to backspace once on line 4, that should put everything on one line. it worked for me