PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Fri Aug 14, 2020 3:42 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed Aug 26, 2015 4:00 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4434
Location: United Kingdom
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?

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Wed Aug 26, 2015 6:19 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6425
Location: Montreal, Canada
Something like this? http://jsfiddle.net/zwcvd5ae/

_________________


Top
 Profile  
 
PostPosted: Thu Aug 27, 2015 10:31 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
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.

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group