$(document).ready(function() { //copied from jquery-mobile var input = $("textarea#body"), extraLineHeight = 15, keyupTimeoutBuffer = 100, keyupTimeout; input._keyup = function() { var scrollHeight = input[ 0 ].scrollHeight, clientHeight = input[ 0 ].clientHeight; if ( clientHeight < scrollHeight ) { input.height( scrollHeight + extraLineHeight ); } }; input.on( "keyup change input paste", function() { clearTimeout( keyupTimeout ); keyupTimeout = setTimeout( input._keyup, keyupTimeoutBuffer ); }); });