tags:

views:

778

answers:

3

I'm trying to make a textarea grow when you press enter and shrink when you finish deleting a line. In other words, the textarea remains just big enough to contain the text inside of it, while the text is being edited.

Unless anyone knows a better way to do this, right now I'm doing it with jquery detecting keypresses. It's fairly easy to make the textarea larger on an enter press, but I'm at a loss as to how to make it shrink when you delete a carriage return.

How do you (preferably with jquery) detect when a carriage return is deleted in a textarea?

+5  A: 

Here you go. Or this one.

Michael Haren
That second link contracts as lines are deleted--which is what I think you wanted.
Michael Haren
+1  A: 

Try to TextArea resizer plugin:

http://plugins.jquery.com/project/TextAreaResizer

acrosman
That's a little different from what he wants.
dalbaeb
A: 

Which JQuery Plugin use StackOverFlow for this "Your Answer" Textbox? http://plugins.jquery.com/project/TextAreaResizer look same, but its working not correctly, that Plugin here working fine.

Katsumi