Skip to content

Instantly share code, notes, and snippets.

/*
* Scale all textareas dynamically on the page
* Requires Prototype
*/
Event.observe(window, 'load', function() {
$$('textarea').each(function(t){
t.scale = function (){
this.style.height = $F(this).split('\n').size() + 8 + "em";
setTimeout(function(thisObj){ thisObj.scale(); }, 1000, this);
};