Posted By

stancox on 10/22/09


Tagged

counter characters


Versions (?)

Simple characters counter


 / Published in: jQuery
 

URL: http://woorkup.com/2009/10/14/jquery-lessons-how-to-interact-with-html-forms/

  1. <!-- HTML -->
  2. <input type="text" id="input-text"/><span id="count"></span>
  3.  
  4. //JavaScript
  5. $(document).ready(function() {
  6. $("input[id='input-text']").keyup(function count(){
  7. counter = $("input[id='input-text']").val().length;
  8. $("#count").html(counter);
  9. });
  10. });

Report this snippet  

You need to login to post a comment.