Page 1 of 1

textarea: can you make it same height as content text?

Posted: Wed Aug 26, 2015 4:00 am
by simonmlewis
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?

Re: textarea: can you make it same height as content text?

Posted: Wed Aug 26, 2015 6:19 am
by Celauran
Something like this? http://jsfiddle.net/zwcvd5ae/

Re: textarea: can you make it same height as content text?

Posted: Thu Aug 27, 2015 10:31 am
by pickle
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.