From 993c283e9a1a564b1882547fd91cfbf01557ca6a Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 16 Jun 2010 20:46:37 +0200 Subject: [PATCH] textarea_grow jquery plugin --- public/js/jquery.textarea_grow.js | 16 ++++++++++++++++ templates/data/items/table.html.ep | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 public/js/jquery.textarea_grow.js 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 + + -- 2.20.1