1function autoResize() {
2 console.log('resizing');
3 textInput.style.height = (textInput.scrollHeight) + 'px';
4}
1$('textarea').each(function () {
2 this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
3}).on('input', function () {
4 this.style.height = 'auto';
5 this.style.height = (this.scrollHeight) + 'px';
6});