网络编程 
首页 > 网络编程 > 浏览文章

基于jquery的让textarea自适应高度的插件

(编辑:jimmy 日期: 2025/7/2 浏览:3 次 )
Introduction
1. This textarea is like the google calendar's description when you create one new or update one existence calendar;
2. Its height will be changed accroding to user's input;
3. Its scrollbar is removed, which makes it much user friendly. I guess you may like it.

Using the code

1. import the jquery.js and textarea.js
<script language="javascript" type="text/javascript" src="/UploadFiles/2021-04-02/jquery.min.js"><script language="javascript" type="text/javascript" src="/UploadFiles/2021-04-02/textarea.js">
2. add the following css
<style type="text/css">
.autoHeight{border:1px solid #666666; width:300px; height:60px; line-height:20px; font:11px verdana; overflow:hidden;}
</style>

3. add one textare html control
<textarea class="autoHeight" id="textarea1"></textarea>

4. make it works
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$(".autoHeight").TextAreaAutoHeight();
});
</script>
上一篇:jQuery dialog 异步调用ashx,webservice数据的代码
下一篇:jQuery的实现原理的模拟代码 -4 重要的扩展函数 extend
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap