Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

html textarea auto height to amount of text

$('textarea').each(function () {
  this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
}).on('input', function () {
  this.style.height = 'auto';
  this.style.height = (this.scrollHeight) + 'px';
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #textarea #auto #height #amount #text
ADD COMMENT
Topic
Name
8+2 =