How about http://www.jacklmoore.com/autosize/ Drop Autosize into any web page and it should Just Work. The source is short and well commented if you are curious to how it works.
// Example:
$(document).ready(function(){
$('textarea').autosize();
});
Source: https://github.com/jackmoore/autosize
Demo: http://www.jacklmoore.com/autosize/