How can I make a textarea automatically expand using jQuery?
I have a textbox for explaining the agenda of the meeting, so I want to expand that textbox when my agenda's text keep growing that textbox area.
How can I make a textarea automatically expand using jQuery?
I have a textbox for explaining the agenda of the meeting, so I want to expand that textbox when my agenda's text keep growing that textbox area.
This worked for me better:
Grows / Shrinks textarea. This demo utilizes jQuery for event binding, but it's not a must in any way.
(no IE support - IE doesn't respond to rows attribute change)
DEMO PAGE
HTML
CSS
javascript (updated)
I've used the Textarea Expander jQuery plugin before with good results.
To define a auto expandable textarea, you have to do two things:
Here is a handmade function to accomplish the task.
Working fine with almost all browser ( < IE7 ). Here is the method:
HERE is a post about this.
I wanted animations and auto-shrink. The combination is apparently hard, because people came up with pretty intense solutions for it. I've made it multi-textarea-proof, too. And it isn't as ridiculously heavy as the jQuery plugin.
I've based myself on vsync's answer (and the improvement he made for it), http://codepen.io/anon/pen/vlIwj is the codepen for my improvement.
HTML
CSS
JS