Skip to content
Advertisement

Resize textarea based on lines of text that comes from php/mysql variable

I dont need it to resize automatically as you type, I just need it to be the correct size when the page loads the variable is $row['text'];

<textarea style="width:630px;"><? echo $row['text'];  ?></textarea>

so when the page loads, the textarea will display the value of that text. I am trying to have it where it counts how many lines and sets the height of the text area based on that

Advertisement

Answer

YOu can use a jquery plugin:

http://www.jacklmoore.com/autosize

Or you can use CSS set the width and height to auto

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement