2017-07-20 22:55:08 xiaoqiu_net 阅读数 11479 收藏 更多
分类专栏: Web
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.youkuaiyun.com/q646926099/article/details/75579079
<textarea v-model="cureInfo.Symptom" id="symptomTxt" οninput="autoTextAreaHeight(this)" ></textarea>
js处理:
-
function autoTextAreaHeight(o) { -
o.style.height = o.scrollTop + o.scrollHeight + "px"; -
} -
$(function () { -
var ele = document.getElementById("symptomTxt"); -
autoTextAreaHeight(ele); -
})

本文介绍了一个简单的JavaScript函数,用于自动调整HTML中Textarea元素的高度,确保其能够根据输入内容的长度自适应显示,避免滚动条不必要的出现,提升用户体验。
1286

被折叠的 条评论
为什么被折叠?



