0

I have textarea, which will be auto-populated on page load. I'm trying to increase its height based of content loaded.

This is what i'm trying to do,

JS :

$('#xyz').text('dynamic content').attr('disabled',true);
textAreaModalAdjust(document.getElementById('xyz'));

function textAreaModalAdjust(o) {
        o.style.height = "1px";     
        setTimeout(function() {
            o.style.height = (25+o.scrollHeight)+"px";
        }, 1);
    }

Even, i tried without "setTimeout", no luck.

Naju
  • 19
  • 6
  • Looks like there is another thread that covers this on http://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize – Matz Oct 03 '16 at 21:10
  • http://stackoverflow.com/questions/17772260/textarea-auto-height http://stackoverflow.com/questions/25518182/textarea-autoheight-css http://stackoverflow.com/questions/995168/textarea-to-resize-based-on-content-length – Amr Elgarhy Oct 03 '16 at 22:00

0 Answers0