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?