title: jQuery function to count characters in textarea is not working as expected
body: <p>The below code is used to count characters in a <code>textarea</code>. The problem is, when I press "enter" (while focused on the <code>textarea</code>) the remaining characters are displayed but the <code>textarea</code> limit is over. Can someone help me with this?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
    var text_max = 99;
    $('#textarea_feedback').html(text_max + ' characters remaining');
  
    $('#textarea').keyup(function() {
      var text_length = $('#textarea').val().length;
      var text_remaining = text_max - text_length;
  
      $('#textarea_feedback').html(text_remaining + ' characters remaining');
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;textarea id="textarea"&gt;&lt;/textarea&gt;
  &lt;p id="textarea_feedback"&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>