dimboiu / autogrow

A pure javascript function that gives the ability for a textarea to automatically grow and shrink dynamically with its content

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

autogrow

A minimal/pure javascript function that gives the ability for a textarea to automatically grow and shrink dynamically with its content.

Currently works for new lines only (.\n').

Instructions

Include the script in your page:

<script src="path/to/autogrow.js"></script>

Initialize the script using the textarea id:

var t = Autogrow('mytextarea');

You're done!

PS: You can use multiple variables to initiate multiple textarea's on the same page:

var t1 = Autogrow('mytextarea1');
var t2 = Autogrow('mytextarea2');
...

Feel free to do anything you want with this script.

*Use at your own risk

About

A pure javascript function that gives the ability for a textarea to automatically grow and shrink dynamically with its content

License:MIT License


Languages

Language:HTML 70.3%Language:JavaScript 29.7%