dynamic-textarea

0.0.2 • Public • Published

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();
    }
});

Package Sidebar

Install

npm i dynamic-textarea

Weekly Downloads

1

Version

0.0.2

License

MIT

Last publish

Collaborators

  • fagner