textarea根據內容自動增加高度

 

2017-07-20 22:55:08 xiaoqiu_net 閱讀數 11479  收藏 更多

分類專欄: Web

版權聲明:本文爲博主原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接和本聲明。

本文鏈接:https://blog.csdn.net/q646926099/article/details/75579079

<textarea v-model="cureInfo.Symptom" id="symptomTxt" οninput="autoTextAreaHeight(this)" ></textarea>

js處理:

 


 
  1. function autoTextAreaHeight(o) {

  2. o.style.height = o.scrollTop + o.scrollHeight + "px";

  3. }

  4. $(function () {

  5. var ele = document.getElementById("symptomTxt");

  6. autoTextAreaHeight(ele);

  7. })

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章