Allegedly topic finished, but i can not post a message


#1



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


There is no error message, Topic says i finished it. But it says i can post a message now. And i can not. The error is 'script error'


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


$('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;
    $('.counter').text(charactersLeft);
    
    if (charactersLeft < 0) {
        $('.btn').addClass('disabled');
    }    
    else if (charactersLeft == 140) {
        $('.btn').addClass('disabled');
    }    
    else { 
    $('.btn').removeClass('disabled');
    }
});

   
   $('.btn').addClass('disabled');
   



};

$(document).ready(main);


#2

Ah i found my own mistake by comparing it with the code shown in the beginning of the Topic.
It was the "." in $('.<li>').text(post).prependTo('.posts');
It is not supposed to be there


#3

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.