Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
190
rated 0 times [  195] [ 5]  / answers: 1 / hits: 28270  / 10 Years ago, sun, may 4, 2014, 12:00:00

Is there anyway through CSS or Javascript set the height of the textarea based on the content? I have a hardcoded height in my CSS but i wanted it to default so there is no vertical scroll bar on page load?


More From » html

 Answers
215

How about http://www.jacklmoore.com/autosize/ Drop Autosize into any web page and it should Just Work. The source is short and well commented if you are curious to how it works.



// Example:
$(document).ready(function(){
$('textarea').autosize();
});


Source: https://github.com/jackmoore/autosize



Demo: http://www.jacklmoore.com/autosize/


[#71195] Thursday, May 1, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
collinarnoldp

Total Points: 10
Total Questions: 122
Total Answers: 109

Location: Spain
Member since Thu, Dec 23, 2021
2 Years ago
;