<script src="https://cdn.bootcss.com/jquery/1.8.1/jquery.js"></script>
<script>
    $(function(){
        function autoHeight(ele){
            var $this = $(ele);
            $this.css({'height':'20px','overflow-y':'hidden'}).height(ele.scrollHeight);
            if(parseInt($this.height())>60){
                $this.height(60);
            }
        }
        $('.text').on('input propertychange',function(){
            autoHeight(this);
        })
    $('.text').trigger("input");
$('.text').trigger("propertychange");
})
 }) </script>
<textarea name="message"  class="text"></textarea>

 

相关文章:

  • 2021-12-22
  • 2021-12-21
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2021-12-21
  • 2021-12-21
  • 2021-12-21
  • 2021-12-21
  • 2021-06-12
  • 2022-02-08
  • 2022-03-03
相关资源
相似解决方案