how to do a character count

how to do a character count

hello everyone I have just started jquery and i am having difficulty doing a character counter. I have a textbox were users type words and i would like to keep track of the character there onkeydown and then display how many(number) of characters in a smaller textbox right now i have... the code below does not work at all any help..

  1. <script>
             $(document).ready(function () {

         //the textbox that i want to track characters
                 $("#myarticles").change(function () {




  2.                //calculate how many characters
                     var n = $("#myarticles").val().length;

  3.   //display the length of characters in this counter
                     $("#countt").text = n;
                 });



             });
              </script>