Created
March 29, 2012 22:42
-
-
Save ziadoz/2244501 to your computer and use it in GitHub Desktop.
jQuery TextArea Auto Height
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
$('textarea.notes').on('focus blur keyup', function() { | |
var paddingTop = $(this).css('padding-top').replace('px', ''), | |
paddingBottom = $(this).css('padding-bottom').replace('px', ''); | |
$(this).css('height', '1px'); | |
$(this).css('height', (this.scrollHeight - paddingTop - paddingBottom) + 'px'); | |
}).blur(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment