Small jQuery plugin to allow dynamic resizing of textarea height, so that it grows as based on visitor input. To use, just call the .autosize()
method on any textarea element. Example $('textarea').autosize();
. See the project page for documentation and a demonstration. Released under the MIT license.
- Reworked to only create a single mirror element, instead of one for each textarea.
- Dropped feature detection for FF3 and Safari 4.
- Added 'append' option for appending whitespace to the end of the height calculation (an extra newline improves the apperance when animating).
- Added a demonstration of animating the height change using a CSS transition.
- Added optional callback that fires after resize.
- Fixed a bug I introduced in the last update.
- Added workaround to get Chrome to reflow default text better.
- Added 'lineHeight' to the list of styles considered for size detection.
- Added 'textIndent' to the list of styles considered for size detection.
- Added vender prefixes to box-sizing detection
-
Added conditional so that autosize cannot be applied twice to the same element
-
When autosize is applied to an element, it will have a data property that links it to the mirrored textarea element. This will make it easier to keep track of and remove unneeded mirror elements. Example:
$('textarea.example').data('mirror').remove(); // delete the mirror
$('textarea.example').remove(); // delete the original
- Now supports box-sizing:border-box
- added binding to allow autosize to be triggered manually. Example: $('#myTextArea').trigger('autosize');
- fixed a regression in detecting FireFox support
- added branching to exclude old browsers (FF3- & Safari4-)
- fixed a regression in 1.1 relating to Opera.
- fixed a regression in 1.1 that broke autosize for IE9.
- autosize now follows the max-height of textareas. OverflowY will be set to scroll once the content height exceeds max-height.
- first release