-2
I configured a textarea to resize the size as the user type but when the value comes from the server the field is only the size of a line. How do you fix this?
-2
I configured a textarea to resize the size as the user type but when the value comes from the server the field is only the size of a line. How do you fix this?
0
Follow the solution for whoever needs 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';
}
}
Browser other questions tagged html5
You are not signed in. Login or sign up in order to post.
Post a piece of your code so we can help you better.
– David Alves
Where it is being saved, what is the maximum size of the text?
– Sveen
$(".textarea-auto"). keyup(me.autoResize); this.autoResize = Function() { objTextArea = $(this); this.style.cssText = 'height:' + this.scrollHeight + 'px'; };
– Andersson OS
Now how do I for a field that will be filled by a value returned from the server?
– Andersson OS