Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery TextArea Auto Height
$('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
You can’t perform that action at this time.