PHP Developers Network
http://forums.devnetwork.net/

textarea: can you make it same height as content text?
http://forums.devnetwork.net/viewtopic.php?f=68&t=141691
Page 1 of 1

Author:  simonmlewis [ Wed Aug 26, 2015 4:00 am ]
Post subject:  textarea: can you make it same height as content text?

We have a textarea per row, showing a description. But we don't want to have to keep resizing the box.
I have a script that will resize a box when you Add a product, but we want the textarea to be the height of the text within it.

I thought "height: auto" would work, but it doesn't.

Any ideas?

Author:  Celauran [ Wed Aug 26, 2015 6:19 am ]
Post subject:  Re: textarea: can you make it same height as content text?

Something like this? http://jsfiddle.net/zwcvd5ae/

Author:  pickle [ Thu Aug 27, 2015 10:31 am ]
Post subject:  Re: textarea: can you make it same height as content text?

About the only way I know of is to use Javascript. Create an invisible <div> off screen that is the same width as the textarea will be, then insert the content into that div. Then, find the height of that div and set the height of the textarea to the same.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/