Automatically resizes <input> and <textarea> elements as the user types to fit the entire value.
Respects min/max-width/height and every other CSS property you can imagine because the element's computed
CSS properties are copied verbatim to a dummy offscreen <div> for measuring.
- jQuery
- Underscore
- IE 8+
- Chrome, Safari, Firefox
Inputs:
$('input').autoWidth();TextAreas:
$('textarea').autoHeight();| Name | Type | Default Value | Element |
|---|---|---|---|
numPaddingChars |
{Number} |
1 |
<input> |
numPaddingLines |
{Number} |
0 |
<textarea> |
Example:
$('input').autoWidth({
numPaddingChars: 2
});
$('textarea').autoHeight({
numPaddingLines: 1
});-
Breaks undo/redo in IE 8. See jQuery UI bug #7873.
IE won't allow [you] to perform CTRL + Z (undo) immediately after a DOM append or
innerHTMLoperation.
Released under the MIT license.