Guest User

MngoDungo

a guest
Jun 22nd, 2010
1,270
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function($) {
  2.    $.fn.textareacontrol = function(settings) {
  3.     lbc = function(str){
  4.         var s = str.replace(/\r/g,'').split('\n');
  5.         return s.length
  6.     }
  7.     $(this).live('keyup', function(event){
  8.         var element=$(this);
  9.             var lb=lbc(element.val());
  10.             if(event.keyCode=='13') {
  11.                 var new_rows=(lb);
  12.                 $(this).attr("rows",new_rows);
  13.             }
  14.             if(event.keyCode=='8' || event.keyCode=='46') {
  15.                 var new_rows=(lb);
  16.                 element.attr("rows",new_rows); 
  17.             }
  18.        
  19.     });
  20.     return this;
  21.    };
  22.  })(jQuery);
RAW Paste Data