To make a textarea autogrow, simply do this
1. download jsquery plugin : http://plugins.jquery.com/files/jquery.autogrow-1.0.2.1.zip
2. extract to you localhost folder and crate dome.html file
call jquery javascript
- Code: Select all
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.autogrow.js"></script>
crate function javascript
- Code: Select all
<script type="text/javascript">
$(document).ready (function() {
$('textarea.expanding').autogrow();
});
</script>
<style type="text/css">
textarea.expanding {
line-height: 18px;
}
</style>
and then make your textarea form
- Code: Select all
<form>
<textarea style="width: 400px; height: 84px; min-height: 84px;" class="expanding" name="myTextarea"></textarea> example 1 <br>
<textarea class="expanding" style="max-height: 100px" name="myTextarea2"></textarea> example 2
</form>
you can see demo : http://www.ajax-tutorial.net/download/jquery/demo/textarea-autogrow/
download file demo have modification: http://www.ajax-tutorial.net/ajax-tutorials/ajax-auto-growing-textarea/

