
Autobox is a lightweight jQuery textarea resize plugin which automatically adjust the height and width of the regular textarea element to match its content while typing.
1. Install the Autobox with NPM:
# NPM $ npm install jquery.autobox --save
2. Import jQuery and the Autobox module.
import jQuery from 'jquery'; import autobox from 'jquery.autobox';
3. Or directly include jQuery library and the Autobox plugin's script on the html page.
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"> </script> <script src="dist/jquery.autobox.js"></script>
4. Activate the auto grow functionality on your textarea elements.
<div class="container"> <textarea></textarea> <textarea></textarea> <textarea></textarea> ... </div>
$('.container').autoboxBind();
5. Or on a specific textarea element.
<div class="container"> <textarea class="demo"></textarea> </div>
$(document).autoboxOn('textarea.demo');
This awesome jQuery plugin is developed by duzun. For more Advanced Usages, please check the demo page or visit the official website.
- Publication date: 15.04.2018
- Source