title: jQuery autoresize pre-filled textarea on load
body: <p>I have a textarea which is created after a successful AJAX call. It may contain quite a lot of text, and I would like it's height to be automatically set so that the whole text would be visible without scrolling. </p>
  
  <p>I am using autoResize plugin (http://james.padolsey.com/javascript/jquery-plugin-autoresize/), but it resizes inputs only on user input.</p>
  
  <p>So, how do I resize a textarea so it would fit the text it contains?</p>
  
  <p>Here is the code of the relevant function (var type can be 'input' or 'textarea')</p>
  
  <pre><code>function edit_create_input(name, value, type, autocomplete, autoresize)
      {
      var input=$('&lt;' + type + ' class="edit-"' + name + '  name="'+name+'"&gt;').val(value); 
      if (autocomplete)
          {
          input.autocomplete("ajax.autosuggest.php",{'multiple':true});
          }
      if (autoresize)
          {
          input.autoResize();
          }
      return input;
  </code></pre>