views:

313

answers:

3

I am using jQuery as my Javascript library. Is there any way to make a textbox grow to fit the size of its contents?

A: 

Yes.

However, as a user, I would be against it. Why not make the textbox large enough to store my input in the first place?

strager
I don't think this is a very useful answer strager, more of a comment. I'm sure there's a neat design concept there you've pooed on.
jeerose
"Make it large enough to begin with" is the answer in my post.
strager
@jeerose - I do see you point for 99.9999% of situations
Ankur
The most obvious reason why not is that it's one of those little text boxes that's just sitting around waiting for you to enter text into it, but most of the time you're just going to ignore it. Facebook has lots of examples of this. The box starts small and unobtrusive but as you type it grows as needed.
Nate C-K
+2  A: 

I think this one would be useful for you.

Text Grow

rahul
A: 

This is the best implementation I have found, it's lightweight and has worked wherever I have used it.

http://onehackoranother.com/projects/jquery/jquery-grab-bag/autogrow-textarea.html

It will grow and shrink according to text size.

xiaohouzi79