Created
June 20, 2018 07:15
-
-
Save webinmd/8a27f8eb4542c2b484b4f5d1ef2ad911 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// textarea auto expand | |
var textarea = document.querySelector('textarea'); | |
textarea.addEventListener('keydown', autosize); | |
function autosize(){ | |
var el = this; | |
setTimeout(function(){ | |
el.style.cssText = ''; | |
el.style.cssText = 'height:' + el.scrollHeight + 'px'; | |
},0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment