SO fiddle
Test Fiddle mainly for SO Questions
by Nick Craver
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/overcast/jquery-ui.css">
<textarea class="autoGrow" style="width:78%;height:75px;overflow:hidden" rows="6" cols ="80" id="input">Test Content
That
Needs
To
Be
Expanded</textarea>
<textarea class="autoGrow" style="width:78%;height:75px;overflow:hidden" rows="6" cols ="80">Another
Test Content
That
Needs
To
Be
Expanded</textarea>
JavaScript
jQuery.fn.resizeTextarea = function(min) {
min = min || 75;
return this.bind("keyup change click focus", function() {
var sh = this.scrollHeight;
$(this).height(function(i, h) {
return h <= sh && sh != 0 ? sh : min;
});
}).trigger("keyup");
};
$(function() {
$('.autoGrow').resizeTextarea();
});