6 - reset the counter


#1

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

"Oops, try again. Remember to update the '.counter' to show how many characters are left."

what am I doing wrong?

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

  • ').text(post).prependTo('.posts');
    $('.status-box').val('');
    $('counter').text('140');
    $(this).postLength.val().length
    });
    $('.status-box').keyup()

    }

    $(document).ready(main);


  • #2

    Quite a number of stuffs ain't right!

    var main = function() {
        $('.btn').click(function(){
                var post = $('.status-box').val();
                $('<li>').text(post).prependTo('.posts');
                $('.status-box').val('');
                $('.counter').text('140');
            });
        
        $('.status-box').keyup(function() {
                var postLength = $(this).val().length
                var charactersLeft = 140 - postLength
                $('.counter').text(charactersLeft);
            });
    }
    $(document).ready(main);

    Study and see that in your case, you hadn't set for a counter reset.

    Hope this helps! :smile:


    #3

    yaaass thank you!! not sure why my answers were accepted previously since mine doesnt look right in comparison but thank youuu


    #4

    Maybe a bug!

    You're welcome.

    Have fun coding! :smile:


    #5

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