title: Show how many characters remaining in a HTML text box using JavaScript
body: <p>This is my code:</p>
  
  <pre><code>function textCounter(field, countfield, maxlimit) {
      if (field.value.length &gt; maxlimit) {
          field.value = field.value.substring(0, 160);
          field.blur();
          field.focus();
          return false;
      } else {
          countfield.value = maxlimit - field.value.length;
      }
  }
  </code></pre>
  
  <p>How can I display how many characters are remaining from a certain text box with a limit of 160?</p>