这是一个可能重复的问题:
可能重复:
使用原型自动调整文本区域的大小
如何根据用户输入的文本行数来更改文本区域的高度?
例如,如果用户在下面的文本区域中更改文本以超过一行,则文本区域会在自身上放置滚动条而不是更改其高度以适应文本行数。
<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>