Home Ajax Jquery autogeneratetext
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

autogeneratetext

Advertisement
autogeneratetext

jQuery To Auto generate TextArea with Fixed Min-Height

No Max-height Fixed

In this JQuery tutorial we will develop a program that Auto generate of a Textarea

Steps to develop the Auto generate of a Textarea .

Step 1:

Create a new file (autoGrowText.html) and add the following code into it:

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title>Tabs</title>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script/jquery.autogrow.js"></script>

<script type="text/javascript">
$(document).ready (function() {

$('textarea.expandText').autogrow();

});
</script>
<style type="text/css">

textarea.expandText {
line-height: 10px;
}

</style>
</head>
<body>

TextArea Min-Height 100Px
<textarea style="width: 300px; min-height: 100px;" class="expandText" name="myTextarea">
</textarea>

</body>
</html>

Program explanation:

The following code includes the jQuery JavaScript library file:

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript" src="script/jquery.autogrow.js"></script>

The Code

$('textarea.expandText').autogrow();

 This function works auto generate the textarea of id "expandText" 

and having correponding style css.

textarea.expandText {
line-height: 10px;
}

This increase the height 10px per line and Minimum height 100px  

Output :

Min Height : 100 px

No Max- Height 

Output :

 

Check online demo of the application

Learn from experts! Attend jQuery Training classes.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2011

Related Tutorials

Ask Questions?      

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com