textarea自动调节高度

js代码

  textareaHeight:function(){

    $("textarea").bind("input propertychange focus", function () {

              this.style.posHeight = this.scrollHeight;

    });

    $("textarea").each(function () {

             this.style.posHeight = this.scrollHeight;

    });

  }

HTML代码

<textarea style="100%;">

  IE支持 onPropertyChange 火狐支持oninput
  IE支持 onPropertyChange 火狐支持oninput

</textarea>

原文地址:https://www.cnblogs.com/recent/p/3597929.html