| 776 |
lars |
1 |
## Summary
|
|
|
2 |
|
|
|
3 |
Autosize is a small, stand-alone script to automatically adjust textarea height to fit text.
|
|
|
4 |
|
|
|
5 |
#### Demo
|
|
|
6 |
|
|
|
7 |
Full documentation and a demo can be found at [jacklmoore.com/autosize](http://jacklmoore.com/autosize)
|
|
|
8 |
|
|
|
9 |
#### Install via NPM
|
|
|
10 |
```bash
|
|
|
11 |
npm install autosize
|
|
|
12 |
```
|
|
|
13 |
#### Install via Bower
|
|
|
14 |
```bash
|
|
|
15 |
bower install autosize
|
|
|
16 |
```
|
|
|
17 |
|
|
|
18 |
#### Browser compatibility
|
|
|
19 |
|
|
|
20 |
Chrome | Firefox | IE | Safari | iOS Safari | Android | Opera Mini | Windows Phone IE
|
|
|
21 |
------ | --------|----|--------|------------|---------|------------|------------------
|
|
|
22 |
yes | yes | 9 | yes | yes | 4 | ? | 8.1
|
|
|
23 |
|
|
|
24 |
#### Usage
|
|
|
25 |
|
|
|
26 |
The autosize function accepts a single textarea element, or an array or array-like object (such as a NodeList or jQuery collection) of textarea elements.
|
|
|
27 |
|
|
|
28 |
```javascript
|
|
|
29 |
// from a NodeList
|
|
|
30 |
autosize(document.querySelectorAll('textarea'));
|
|
|
31 |
|
|
|
32 |
// from a single Node
|
|
|
33 |
autosize(document.querySelector('textarea'));
|
|
|
34 |
|
|
|
35 |
// from a jQuery collection
|
|
|
36 |
autosize($('textarea'));
|
|
|
37 |
```
|
|
|
38 |
|
|
|
39 |
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php)
|