dynamic-textarea
v0.0.2
Published
A simple dynamic textarea decorator that just works without jQuery
Downloads
11
Maintainers
Readme
Dynamic Textarea
A simple dynamic textarea decorator that just works without jQuery
Installation
Just include the script in the page:
<script src="/path/to/dynamic-textarea.js"></script>
dynamic-textarea supports npm and Bower under the name dynamic-textarea
It can also be loaded as an AMD module.
Usage
Add the data-dynamic
attribute to the textarea
elements and they will magically grow to fit the content (even for dynamic added elements!):
<textarea data-dynamic></textarea>
API
The api is exposed only in AMD capable environments to prevent polluting the global scope unnecessarily.
.refresh()
Update the height of all dynamic textareas relative to its content.
Example:
require( [ "dynamic-textarea" ], function( dynamicTextarea ) {
if ( someArbitraryEventHappens ) {
dynamicTextarea.refresh();
}
});