My code doesn't work on exercise 5


#1

Mine still didn't work. This is my code:

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

').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);

5. Count characters left
#2

Hi Rachelrocks2007,

That code looks suspiciously similar to something copy/pasted from the forum - I strongly recommend against doing that, because then you'll have much less of an understanding of what the code is actually doing.

That needs to be $('<li>') instead.


#3

I tried but it didn't work.


#4

@rachelrocks2007 Well in that case, post your new code so I can find the problem(s) in it.

I'm not a magic genie - I need to see your code to help you, and I need you to format it properly so I can see it: