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


#1


Count characters left

Oops, try again. Remember to update the '.counter' to show how many characters are left.
What's the error?

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


Titre
#2

HI you should close the $(".btn").click(function() with }); instead of )

  $(".btn").click(function() {
      var post = $(".status-box").val();
      $("<li>").text(post).prependTo(".posts");
      $('.status-box').val("");
  } <--- #here

#3

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