jquery.autogrow-textarea

A jquery plugin for automatic vertical or horizontal growing of text areas.

Showing:

Popularity

Downloads/wk

251

GitHub Stars

15

Maintenance

Last Commit

6yrs ago

Contributors

2

Package

Dependencies

0

Size (min+gzip)

1.4KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

This is a jquery plugin that will auto-grow your text areas vertically (like facebook) or horizontally. It is based off a code snippet by dhruvbird. The plugin uses a hidden mirror textarea to calculate the idea height (and width) of the target text area. Differences from the original code snippet are:

  • Support for horizontal auto-growth of text areas. That is, text areas that expand horizontally as you type.
  • Once the plugin has been activated on a textarea, the textarea will listen for the custom "remove.autogrow" event. If that event is triggered, the plugin will clean up the resources that is uses to avoid memory leaks. (Specifcally, the mirror textarea used by the plugin will be removed from the DOM.)

Use:

$( "textarea" ).autogrow();

or for horizontal growth only:

$( "textarea" ).autogrow( { vertical : false, horizontal : true } );

or for both (untested? I can't remember!)

$( "textarea" ).autogrow( { vertical : true, horizontal : true } );

To cleanup before removing original textarea element from DOM, or after plugin is no longer needed:

$( "textarea" ).trigger( "remove.autogrow" );

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial