$('textarea').each(function () {
this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;'); }).on('input', function () { this.style.height = 'auto'; this.style.height = (this.scrollHeight) + 'px'; });
参考:https://segmentfault.com/a/1190000009082811
textarea内容随高度自适应
猜你喜欢
转载自www.cnblogs.com/xyxpython/p/9376823.html
今日推荐
周排行