textarea高度随文字增多变化高度
来源:互联网 发布:淘宝客服售前话术大全 编辑:程序博客网 时间:2024/04/30 22:18
<!DOCTYPE html><html><head><title>autoresizing textarea</title><script src="js/jquery.min.js"></script><style type="text/css">textarea { border: 1px solid red; overflow: hidden; padding: 0;min-height:100px;max-height:300px;}</style></head><body onload="init();"><textarea rows="5" style="height:25px;" id="text"></textarea><script type="text/javascript">var observe;if (window.attachEvent) { observe = function (element, event, handler) { element.attachEvent('on'+event, handler); };}else { observe = function (element, event, handler) { element.addEventListener(event, handler, false); };}function init () { var text = document.getElementById('text'); function resize () { text.style.height = 'auto'; text.style.height = text.scrollHeight+'px'; } /* 0-timeout to get the already changed text */ function delayedResize () { window.setTimeout(resize, 0); } observe(text, 'change', resize); observe(text, 'cut', delayedResize); observe(text, 'paste', delayedResize); observe(text, 'drop', delayedResize); observe(text, 'keydown', delayedResize); text.focus(); text.select(); resize();}</script></body></html>
0 0
- textarea高度随文字增多变化高度
- textarea高度自动变化
- cell高度随文字变化
- div模拟textarea高度随文本变化
- 实现 textarea随内容高度自动变化
- ios中Textview高度随文字的高度的变化而变化
- textarea文本域的高度随内容的变化而变化(适用于编辑文本)
- 背景随高度变化
- 模拟新浪微博评论textarea输入框随着输入内容增多输入框高度自适应
- DIV高度随里边内容的增多而增高
- html中用div代替textarea实现输入框高度随输入内容变化
- js监听textarea文本域变化使高度自适应
- Flex TextArea 根据文字内容自动增加高度
- React textarea自适应文字高度伸缩 超简单版
- div高度随窗口变化而变化
- textarea高度随内容自动伸缩
- textarea自适应高度
- textarea自适应高度
- 在html页面上嵌入JavaScript代码的几种方式
- java代码块
- MongoDB如何确保一致性
- 求二叉树的高度
- MFC中利用ListCtrl的列标题获取列索引的方法
- textarea高度随文字增多变化高度
- 抽象类和接口
- burpsuite 配置代理无效
- 数据库中查找包含换行符的记录
- uva 11129An antiarithmetic permutation
- eclipse启动出现“An Error has Occurred. See the log file”解决方法
- HTTP中的重定向和请求转发的区别
- studio的adb命令
- join on where执行顺序