$(document).ready(function(){
 /**Author: Sachin 
 /**   http://swiki.fromdev.com/2010/02/jquery-maximum-limit-texttextarea-with.html#5
  * Character Counter for inputs and text areas showing characters left.
  */
 $('#counterb').each(function(){
     //maximum limit of characters allowed.
     var maxlimit = 200;
     // get current number of characters
     var length = $(this).val().length;
     if(length >= maxlimit) {
   $(this).val($(this).val().substring(0, maxlimit));
   length = maxlimit;
  }
     // update count on page load
     $(this).parent().find('.counter').html( (maxlimit - length) + ' ');
     // bind on key up event
     $(this).keyup(function(){
  // get new length of characters
  var new_length = $(this).val().length;
  if(new_length >= maxlimit) {
    $(this).val($(this).val().substring(0, maxlimit));
    //update the new length
    new_length = maxlimit;
   }
  // update count
  $(this).parent().find('.counter').html( (maxlimit - new_length) + ' ');
     });
 });

});

