resize textbox automatically according to the content
<p><a href="http://jsfiddle.net/h2vMN/1/" rel="nofollow">http://jsfiddle.net/h2vMN/1/</a></p>

<p>I have a text box text inside it already, in the actual application this will be filled dynamically, but for the sake of this question it has been pre filled.</p>

<pre><code>&lt;textarea id="textarea"&gt;
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tempor commodo ornare. Donec lobortis dui sed lectus egestas tristique. Vivamus vel metus turpis, faucibus varius risus. Aenean ante mauris, ultrices id facilisis vitae, dignissim eget sem. Quisque sed justo lectus, eget aliquet leo. Curabitur in mauris et diam fermentum venenatis. Proin ullamcorper, neque a vehicula euismod, odio enim aliquam ipsum, eu tristique urna sapien nec erat.

Aliquam erat volutpat. In in lacus cursus dolor pellentesque posuere. Cras eu metus urna, a rhoncus ligula. Ut hendrerit orci in arcu dignissim id fermentum orci vulputate. Sed ante ligula, volutpat eu convallis vel, auctor in metus. Mauris euismod, metus eget venenatis sodales, risus tellus volutpat elit, et aliquet massa tellus ut sapien. Mauris tempor posuere massa et consectetur. Duis dignissim enim a nulla ultricies vitae vulputate felis commodo. Phasellus mollis est eget odio porttitor consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Phasellus ut nibh auctor libero sagittis semper vitae quis erat.
&lt;/textarea&gt;​
</code></pre>

<p>When I run the above code, it shows a tiny text area with scroll bars all over it. In other words, completely useless in terms of being user friendly. How do I automatically resize the text box according to the amount of content their is and it has a set width of 600px.</p>

<pre><code>#textarea{width:600px;}​
</code></pre>

<p>I would like a javascript/jquery solution.</p>

<p>I have tried the <code>.autoresize</code> solution unsuccessfully, which can be found here:</p>

<p><a href="http://james.padolsey.com/demos/plugins/jQuery/autoresize.jquery.js/view" rel="nofollow">http://james.padolsey.com/demos/plugins/jQuery/autoresize.jquery.js/view</a></p>

<p>Note, the height should be resized automatically</p>
