Skip to content

Instantly share code, notes, and snippets.

@kt103099
Forked from samg/resize_textareas.js
Created April 23, 2009 23:53
Show Gist options
  • Save kt103099/100847 to your computer and use it in GitHub Desktop.
Save kt103099/100847 to your computer and use it in GitHub Desktop.
/*
* 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);
};
t.scale();
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment