0.0.2 • Published 9 years ago

dynamic-textarea v0.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

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