Socket
Book a DemoInstallSign in
Socket

jquery.autogrow-textarea

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jquery.autogrow-textarea

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](https://code.google.com/p/gaequery/source/browse/trunk/src/static/scripts/jquery.autogrow-textarea.js?r=2

latest
Source
npmnpm
Version
0.4.1
Version published
Weekly downloads
91
-41.67%
Maintainers
2
Weekly downloads
 
Created
Source

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" );

Keywords

jquery

FAQs

Package last updated on 26 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts