Textarea does not resize with the size of the value returned from the server

-2

I set up a textarea to resize the size as the user type, but when the value comes from the server the field is only one line size. How do you resolve this?

    
asked by anonymous 15.05.2018 / 16:04

1 answer

0

Follow the solution for those who need it:

    var me = this;

    this.onload = function () {
        me.bind();
    };

    this.bind = function () {
        $(".textarea-auto").keydown(me.autoResize);
        $('load', me.autoResizeLoad);
    };

    this.autoResize = function () {
        objTextArea = $(this);
        this.style.cssText = 'auto';
        this.style.cssText = 'height:' + this.scrollHeight + 'px';
    };

    this.autoResizeLoad = function () {
        var objTextArea = $('.textarea-auto');
        for (var i = 0, inb = objTextArea.length; i < inb; i++) {
                objTextArea[i].style.cssText = 'auto';
                objTextArea[i].style.cssText = 'height:' + objTextArea[i].scrollHeight + 'px';
        }
    }
    
18.05.2018 / 13:17