I have made it so my textarea is autogrowing and autoshrinking with a script I found here on Stackoverflow. This is working great. My problem however is, that when data is imported from my database, the textarea does not fit the content. If I have 50 lines in my database and importing it to my textarea, it only show 2 lines - where I wan't to be able to see all 50.
Script:
$(document)
.one('focus.textarea', '.autoExpand', function(){
    var savedValue = this.value;
    this.value = '';
    this.baseScrollHeight = this.scrollHeight;
    this.value = savedValue;
})
.on('input.textarea', '.autoExpand', function(){
    var minRows = this.getAttribute('data-min-rows')|0,
        rows;
    this.rows = minRows;
    rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16);
    this.rows = minRows + rows;
});
 
     
    