Simple characters counter


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  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. });

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.