Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best autogrow textarea plugin for jQuery? [closed]

There seem to be a ton of really bad autogrow textarea plugins for jQuery. I want my autogrowing text box to be as good as Facebook's. I want it to fit the current line only, and add a line right before it's needed.

Most of the plugins I've reviewed try to guess line height from number of characters, which seems too naive. I've read one solution that creates a hidden div to calculate height. That seems like the right path, but that solution wasn't in plugin form.

What's out there that does what I want and is easy to install?

like image 295
Sam Grossberg Avatar asked Feb 10 '11 00:02

Sam Grossberg


2 Answers

Try it. http://www.jacklmoore.com/autosize I thing here's the best. It's a very good one.

like image 171
vantrung -cuncon Avatar answered Nov 15 '22 06:11

vantrung -cuncon


I have a plugin that calculates just that: http://www.mostthingsweb.com/2012/01/textarea-line-count-version-1-3-released/. It uses the hidden div approach, and even matches the correct font attributes. Check it out :)

You could invoke the plugin every time a user hits a key in the textbox, and then resize the textbox accordingly. Maybe even every other key, if you want to not hog processing power.

like image 45
Chris Laplante Avatar answered Nov 15 '22 07:11

Chris Laplante