jquery-autoexpand

1.0.2 • Public • Published

jquery-autoexpand

A textarea will automatically grow and shrink in height as you add or remove content to it.

  • The textarea will never shrink smaller than its original height
  • The textarea will never grow beyong the bottom edge of the window. Instead, a scroll bar show up in the textarea as more text as added to the textarea.

Usage

$('textarea').autoExpand();

Or if you want to customize some of the options:

$('textarea').autoExpand({ animationTime: 0, windowPadding: 100 });

Remove

If you no longer need the textarea to auto-expand and you want to reset it:

$('textarea').autoExpand('destroy');

Options

Options can be passed in as a { key: value } object literal. Available options are:

property default value description
animationTime 50 Time in milliseconds to animate to new height
windowPadding 20 Amount of pixels to preserve between textarea & window bottom

You can remove the auto-expander from a textarea by passing 'destroy' (as string, not in an object literal).

Installation

Install this package via npm:

npm install jquery-autoexpand

Or simply copy jquery.autoexpand.js into your project.

License

jquery-autoexpand is MIT licensed.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i jquery-autoexpand

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • matthiasmullie