From: Dobrica Pavlinusic Date: Wed, 16 Jun 2010 18:46:37 +0000 (+0200) Subject: textarea_grow jquery plugin X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=993c283e9a1a564b1882547fd91cfbf01557ca6a;p=MojoFacets.git textarea_grow jquery plugin --- diff --git a/public/js/jquery.textarea_grow.js b/public/js/jquery.textarea_grow.js new file mode 100644 index 0000000..8a0ef57 --- /dev/null +++ b/public/js/jquery.textarea_grow.js @@ -0,0 +1,16 @@ +jQuery.fn.textarea_grow = function(){ + return this.each(function(){ + var rows = this.rows; + console.debug( 'textarea_grow', rows, this ); + var grow = function(ta) { + var lines = ta.value.split('\n').length; + if ( lines > rows ) { + ta.rows = lines; + //console.debug('keyup', lines, rows, ta ); + } + }; + grow(this); + this.onkeyup = function() { grow(this) }; + }); +}; + diff --git a/templates/data/items/table.html.ep b/templates/data/items/table.html.ep index 9692c04..abdd031 100644 --- a/templates/data/items/table.html.ep +++ b/templates/data/items/table.html.ep @@ -57,4 +57,11 @@ filter + +