Created
November 24, 2020 13:14
-
-
Save bhaireshm/cd7ef8ae6df42bd6c766aa290a6e9773 to your computer and use it in GitHub Desktop.
Just call this method to set hieght to textarea automatically whenever content is changed
This file contains 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
function setHeightTextarea () { | |
$("textarea") | |
.on("change keyup keydown paste cut", function () { | |
$(this).height(0).height(this.scrollHeight); | |
}) | |
.find("textarea") | |
.change(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment