auto resize textarea - Free Download Auto Resize Textarea When Typing - auto-resize.js

Free Download Auto Resize Textarea When Typing – auto-resize.js

Posted on

This time I will share jQuery Plugin and tutorial about Auto Resize Textarea When Typing – auto-resize.js, hope it will help you in programming stack.

auto resize textarea - Free Download Auto Resize Textarea When Typing - auto-resize.js
File Size: 4.73 KB
Views Total: 652
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A lightweight yet configurable textarea resize jQuery plugin that dynamically adjusts the visible height of textarea elements while typing.

Great for contact & comment form where the textarea element automatically grows and shrinks to fit its content.

How to use it:

1. Insert the auto-resize.js script after loading the latest jQuery library.

1 <script src="/path/to/jquery.slim.min.js"></script>
2 <script src="/path/to/dist/jquery-auto-resize.min.js"></script>

2. Attach the function autoresize to the existing textarea element and the plugin will take care of the rest.

1 <textarea>
2   Type something here
3 </textarea>
1 $(function(){
2   $('textarea').autoresize();
3 });

3. Customize the min/max visible height (in lines) of the textarea element.

  • minRows: defaults to 2
  • maxRows: defaults to infinity
1 $(function(){
2   // $('textarea').autoresize(minRows, maxRows);
3   $('textarea').autoresize(3, 10);
4 });

This awesome jQuery plugin is developed by RifkyLTF. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net