zoukankan      html  css  js  c++  java
  • textarea高度随内容撑高

    (function($){
          $.fn.autoTextarea = function(options) {
                var defaults={
                  maxHeight:null,
                  minHeight:$(this).height()
                };
                var opts = $.extend({},defaults,options);
                return $(this).each(function() {
                  $(this).height($(this)[0].scrollHeight);
                  $(this).bind("paste cut keydown keyup focus blur",function(){
                    var height,style=this.style;
                    this.style.height = opts.minHeight + 'px';
                    if (this.scrollHeight > opts.minHeight) {
                      if (opts.maxHeight && this.scrollHeight > opts.maxHeight) {
                        height = opts.maxHeight;
                      } else {
                        height = this.scrollHeight;
                      }
                      style.height = height + 'px';
                    }
                  });
                });
              };
            })(jQuery);
        $("#textarea").autoTextarea();

  • 相关阅读:
    线程中测试getName方法和getId方法
    编写一个线程改变窗体的颜色
    创建两个线程分别输出1-100
    输出一个目录中的内容
    file占用字节
    MAP集合选出最大值
    使用增强for循环遍历集合
    数据框中的基本操作
    列表的基本操作
    因子的基本操作
  • 原文地址:https://www.cnblogs.com/hlyin/p/9541806.html
Copyright © 2011-2022 走看看