Autogrow Textarea '+' Parent div height
My Html is like this:
<div style="height: 90px;" class="tabtextarea">
<div>Description:</div>
<textarea style="height: 85px;">TEXT...</tex开发者_高级运维tarea>
</div>
As you can see textarea is contained within a div with specific height so that it doesnt break layout on some browsers due to float styling and etc I am using.
I saw few jquery plugins
that resize the textarea but is there any solution with which I can resize parent div too? There is no need for live resizing, resizing just once when page is loaded is preferred as the data is already populated in it.
Thank You.
Put the text in a hidden div as well - that's the only way you're going to know how much you need to resize textarea. Get the height of that hidden div, then set the height of the textarea, and div.tabtextarea
accordingly.
精彩评论