a07ab754b4971d9935fe8bcd6b531b43435ca024
[MojoFacets.git] / public / js / jquery.textarea_grow.js
1 jQuery.fn.textarea_grow = function(){
2         return this.each(function(){
3                 var rows = this.rows;
4                 console.debug( 'textarea_grow', rows, this );
5                 var grow = function(ta) {
6                 var lines = ta.value.split('\n').length;
7                         if ( lines != rows ) {
8                                 ta.rows = lines;
9                                 rows    = lines;
10                                 console.debug('keyup', lines, rows, ta );
11                         }
12                 };
13                 grow(this);
14                 this.onkeyup = function() { grow(this) };
15         });
16 };
17