重複の可能性:
プロトタイプを使用したテキストエリアの自動サイズ変更
ユーザーが入力したテキストの行数に基づいてテキスト領域の高さを変更するにはどうすればよいですか?
以下の例では、ユーザーが textarea 内のテキストを複数行のテキストに変更した場合、textarea は行数に合わせて高さを変更するのではなく、それ自体にスクロール バーを配置します。
<textarea>
This is the default text that will be displayed in the browser. When you change this text and add more lines to it the browser will not change the height of the textarea that this text is in rather it will add a scroll bar, which is not what I want.
<textarea>