Lesson 5: Count characters left error


#1

I keep getting this error:
Oops, try again. Remember to update the '.counter' to show how many characters are left.
On the right is also this error: Uncaught SyntaxError: missing ) after argument list
Where am I missing this? I can't seem to find it. If I'm not missing it, then what did I do wrong?

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);
  });
};
    

$(document).ready(main);


#2

The error on the right takes precedence to the SCT error message. There might not be a problem with your code once the syntax error is fixed.

There is a stray } in the click handler.


#3

Thanks, I removed that and the syntax error went away, but I'm still getting the other error


#4

Stare at this for a moment... It will reveal itself..


#5

I figured it out and it was nothing to do with that. I forgot the . on the counter.


#6

Did you fix this line?

$('status-box').val('');    // missing dot in class name