Search This Blog

Resize Textarea on 'Enter' pressed

Posted by Team on
1. Add a textarea to a simple HTML template
2. Now include jQuery CDN or downloaded jquery to your page in head section
3. Add a key press event in document scope.
4. Check if the pressed key is 'Enter'. Also check if control is textarea. (I added event only for Text Area, so no need to check here)
5. Add another event on blur to reduce its size if white space added by user.
6. Get the height of existing control and add some more height. Check-it-out with below snippet.