Skip to content

Instantly share code, notes, and snippets.

@bhaireshm
Created November 24, 2020 13:14
Show Gist options
  • Save bhaireshm/cd7ef8ae6df42bd6c766aa290a6e9773 to your computer and use it in GitHub Desktop.
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
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