textarea高度随内容自适应以及禁止拖拽大小

textarea {
100%;
border: none;
resize: none; /* 禁止拖拽大小 */
background: unset;
}
随内容自适应高度:
js:
var tt = document.getElementById("textarea");
tt.style.height=tt.scrollHeight + 'px';

jquery:
$("#textarea")[0].style.height=$("#textarea")[0].scrollHeight + 'px';


原文地址:https://www.cnblogs.com/jindao3691/p/15294132.html