Textarea隨著輸入增加高度
<textarea onkeyup="autogrow(this)" />
function autogrow(textarea) {
                var adjustedHeight = textarea.clientHeight;
                adjustedHeight = Math.max(textarea.scrollHeight, adjustedHeight);
                if (adjustedHeight > textarea.clientHeight || adjustedHeight < textarea.clientHeight) {
                    textarea.style.height = adjustedHeight + 'px';   
                }
            }
原理: function內:
- 取得目前Textarea的高度
 - 根據目前scrollbar的高度和textrea比較,取大的一方設定為目前的Textarea高
 - 但刪除文字時不會自動縮小,後面再想辦法改。
 
參考: