Created
February 23, 2012 03:14
-
-
Save augustovictor/1889747 to your computer and use it in GitHub Desktop.
Autogrow textarea
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
var heightScroll = $("textarea").get(0).scrollHeight; //Receives scroll height | |
var heightTextarea = $("textarea").height(); //Receives textarea height | |
var height = heightTextarea; | |
for(height; heightScroll > heightTextarea; height++) { | |
heightTextarea = height; //Textarea height receives the current height | |
$("textarea").css("height", height); //Textarea height receives the height value changed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment