jquery文字填写自动高度的实现方法
下面开始写一个jquery插件
(function($){ $.fn.autoTextarea = function(options) { var defaults={ maxHeight:null,//文本框是否自动撑高,默认:null,不自动撑高;如果自动撑高必须输入数值,该值作为文本框自动撑高的最大高度 minHeight:$(this).height() }; var opts = $.extend({},defaults,options); return $(this).each(function() { $(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; style.overflowY = 'scroll'; } else { height = this.scrollHeight; style.overflowY = 'hidden'; } style.height = height + 'px'; } }); }); }; })(jQuery);
调用代码示例:
<textarea name="textarea" id="textarea" cols="60" rows="4" class="chackTextarea-area"></textarea> <script type="text/javascript"> $(".chackTextarea-area").autoTextarea({ maxHeight: 220,//文本框是否自动撑高,默认:null,不自动撑高;如果自动撑高必须输入数值,该值作为文本框自动撑高的最大高度 });
以上这篇jquery文字填写自动高度的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持积木网。
easyui取消表单实时验证,提交时统一验证的简单实例
1、设置表单不验证formid="ff"class="easyui-form"method="post"data-options="novalidate:true"/form2、表单提交时统一验证$('#ff').form('submit',{onSubmit:function(){return$(this).form('en
EasyUI 中combotree 默认不能选择父节点的实现方法
这需要添加如下字段就行,搜了半天,说什么判断是不是子节点什么的,都是胡扯!onlyLeafCheck:true,//病因分类$('#artReason').combotree({width:200,method:'GET',//url:
浅谈EasyUi ComBotree树修改 父节点选择的问题
本人在使用EasyUI期间发现了一个不太适合项目的bug,可能也不算bug把。毕竟不同项目背景取舍不同。我在做网元树选择的时候发现当选取父节点后,子节