Code solutions to PHP, JS, CSSCode source PHP, JS, CSS

Spread your code soluces to the world

Love me
Solucior » JAVASCRIPT » Dynamically resizing height of textarea

Dynamically resizing height of textarea

05/13/2011 by Dux   -   3.9/5 (20 ratings)

This code dynamically resize a textarea according to its contents. It can work when the textarea gains focus and during typing.


source code

<script type="text/javascript">
haut(idt) {
   if (
document.getElementById(idt).scrollTop > 0) aug(idt);
aug(idt) {
h = parseInt(document.getElementById(idt).style.height);
document.getElementById(idt).style.height = h + 10 +"px";
top(idt) {
document.getElementById(idt).scrollTop = 100000;

<textarea name="txt_test" style="width: 700px; height: 150px" id="txt_test" onkeyup="javascript: haut(" onfocus="javascript: top("></textarea>

Tested with Safari  Google Chrome  Firefox3  Firefox4  
Rate this code     |     Copied : 322x

Comments for Dynamically resizing height of textarea

just another     01/29/2018 02:07
uTkor3 When some one searches for his vital thing, thus he/she wishes to be available that in detail, so that thing is maintained over here.
suba buba     11/08/2017 17:47
6HlzDF Say, you got a nice blog article.Really thank you! Really Great.
just another     09/20/2017 16:16
J23VrI Im thankful for the post.Thanks Again. Much obliged.
pron best     07/11/2017 02:09
slukOR I value the blog post.Thanks Again. Keep writing.
pron best     05/10/2017 15:27
jwxxJO I simply could not leave your web site before suggesting that I really enjoyed the standard info an individual supply for your visitors? Is gonna be again steadily to inspect new posts
lucy ann     05/09/2017 15:15
RgqCKK Just Browsing While I was surfing yesterday I saw a excellent post concerning
mike tyson     03/05/2017 00:35
UK1B3m This is one awesome article post.Really looking forward to read more. Awesome. this link
come here     03/04/2017 20:31
JPTWkl Within the event you all be able to email myself by incorporating suggestions in how you have made your website search this brilliant, I ad personally have fun right here.
mike tyson     03/04/2017 17:45
rsqnJi Title It as really a great and useful piece of information. I am glad that you shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.
find out     02/01/2017 10:44
CjcJj7 Some really  nice stuff on this  site, I  it.
Learn More Here     02/01/2017 08:48
HOUUqE If you are ready to watch comic videos on the internet then I suggest you to go to see this web site, it consists of really therefore comical not only videos but also additional material.
that site     02/01/2017 00:36
mSskjP Some  genuinely  prime  posts  on this  internet site ,  saved to bookmarks.
subastian     11/27/2016 08:28
Am5aQ2 This is a terrific website. and i need to take a look at this just about every day of your week ,
suba bob     11/27/2016 00:29
lbLMfy Informative and precise Its difficult to find informative and precise info but here I found
Yep     05/07/2015 01:38
C'est bien. Si on pouvait l'améliorer afin de réduire la taille quand le contenu diminue, ce serait interessant.
Johnd625     11/25/2014 10:26
I really enjoy the article post. Cool. dadekdafeefd
Johnd356     11/25/2014 10:26
Im not that much of a online reader to be honest but your blogs really nice, keep it up! I'll go ahead and bookmark your site to come back later. All the best eecgbeeaekge
Yep     05/23/2013 15:23
Thx mais si tu rajoutes une ligne avant la dernière ligne ça taff pas
pipe     03/20/2013 18:34
Tab     12/03/2012 15:39
Thank you
SaïB     06/26/2012 08:09
Merci pour ce code
Thanks for this code, very helpfull
octameter     06/11/2012 21:04
nice workaround! thx octameter
Add a comment Nickname