title: How to display real time characters count using jQuery?
body: <p>Please check my code below. I want to display input characters number real time using jquery javascript. But problem is when i am doing it with "textarea" it works but when i do same with normal input type text its not work.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Test&lt;/title&gt;
        &lt;script src="http://code.jquery.com/jquery-1.11.1.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;!-- Works  --&gt;
  
  &lt;!-- &lt;textarea&gt;&lt;/textarea&gt;
  &lt;span id="characters"&gt;&lt;span&gt;
  
      &lt;script type='text/javascript'&gt;
          $('textarea').keyup(updateCount);
          $('textarea').keydown(updateCount);
  
          function updateCount() {
              var cs = $(this).val().length;
              $('#characters').text(cs);
          }
      &lt;/script&gt; --&gt;
  
  &lt;!-- Not works --&gt;
  
  &lt;input type="text" name="name"&gt;
  &lt;span id="characters"&gt;&lt;span&gt;
  
  &lt;script type='text/javascript'&gt;
          $('text').keyup(updateCount);
          $('text').keydown(updateCount);
  
          function updateCount() {
              var cs = $(this).val().length;
              $('#characters').text(cs);
          }
   &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>