Press "Enter" to skip to content

Automatically Expand Textarea When Character Limit Is Exceeded | jQuery textpandable.js

Textpandable Plugin is an easy and configurable Textarea extension jQuery plugin that automatically inserts a new row into the textarea when its content exceeds a certain number of characters.

This jQuery plugin was originally published on my blog in June 2009. This plugin has been used and modified for use in many personal and work-related projects but has not been maintained long term.

auto expand input height based on text length, auto resize textarea to fit content, textarea auto expand width, auto resize textarea to fit content css, auto expand input width based on text length

Textpandable in ActionTextpandable provides the following options:

lineHeight: Specify the line-height of the text area – as a Textpandable or CSS declaration option.
minRows and maxRows: Set limits on how small or large the text area can be.
Padding: Set a number of additional rows to provide padding. 1-2 rows are usually a good value.
Width: The number of characters allowed per line before an additional row is added. If not set, Textpandable does its best to specify safe values ​​based on CSS declarations, column attributes, and/or pixel widths.

Add Cascading Animations To Individual Characters or Elements Using Vanilla JavaScript

How to make use of it:

1. Insert the JavaScript textpandable.js after loading the newest jQuery library.

<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/textpandable.js"></script>

2. Initialize the plugin on the goal textarea component and executed.

<textarea>... </textarea>
$(function(){
  $('textarea').textpandable();
});

3. Set the min/max variety of rows. -1 means infinity.

$('textarea').textpandable({
  minRows: 1,
  maxRows: -1,
});

4. Set the utmost variety of characters allowed in a line. When this restrict is exceeded, the plugin will add a brand new row to the textarea.

$('textarea').textpandable({
  width: 10
});

5. Set the padding & line-height properties of the textarea.

$('textarea').textpandable({
  padding : 1,
  lineHeight: "1.4em",
});

6. Apply an easy transition to the textarea when increasing & collapsing.

$('textarea').textpandable({
  speed: 200,
  initSpeed: -1,
});

Auto Expand Textarea When Exceeding Character Limit, Textpandable Plugin/Github, how to increase textarea height dynamically, textarea character limit jquery, textarea no scrollbar auto height


See Demo And Download

Official Website(thomshouse): Click Here

This superior jQuery/javascript plugin is developed by thomshouse. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.