QuestionerNo7
QuestionerNo7

Reputation: 620

Resizeable textarea that resizes constantly on keyup instead of waiting for content to overflow

I'm trying to make a Message Contact Form with a textarea that automatically resizes according to the content inserted. I.e. as the user types in the message, the textarea resizes to fit the message.

For this, I was searching StackOverflow and found this answer.

However, when implementing the JavaScript snippet used there I get a textarea that resizes constantly, upon every keyup action. This is happening when I set the textarea to update with CSS easing. If I just let it resize with no "jaggedly", everything goes fine... but looks less elegant.

You can see what's going on here, in this jsFiddle I've worked up.

Perhaps somebody out there can see what's going on here!

Upvotes: 1

Views: 120

Answers (1)

Malaiyandi Murugan
Malaiyandi Murugan

Reputation: 393

You better use a jquery plugin for resizing height of the textarea. I personally recommend this: http://www.jacklmoore.com/autosize

Upvotes: 2

Related Questions