×

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

作者:Terry2017.02.04来源:Web前端之家浏览:12694评论:0
关键词:JQueryJS
introduction
1. thisTextarea 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="js/jQuery.min.js"></script>
<script language="Javascript" type="text/javascript" src="js/textarea.js"></script>

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>

您的支持是我们创作的动力!
温馨提示:本文作者系Terry ,经Web前端之家编辑修改或补充,转载请注明出处和本文链接:
https://jiangweishan.com/article/svg1486137600768.html

网友评论文明上网理性发言已有0人参与

发表评论: