Skip to content

Instantly share code, notes, and snippets.

@antonreshetov
Created January 31, 2017 08:22
Show Gist options
  • Save antonreshetov/ae540bee3943c577d41ef6fb29510f3b to your computer and use it in GitHub Desktop.
Save antonreshetov/ae540bee3943c577d41ef6fb29510f3b to your computer and use it in GitHub Desktop.
function textAreaResize() {
var textArea = document.getElementById('text');
textArea.addEventListener('input', resize);
function resize() {
textArea.style.height = 'auto';
textArea.style.height = text.scrollHeight + 2 + 'px';
}
}
textAreaResize();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment