JQuery AJAX Mobile Extensible Text Area

I load the text into the input field through $("textarea").val(ajaxData);, but it will not be automatic, and my data will not be completely displayed. Is there a way or anything that I can call to force the update?

+5
source share
3 answers

In fact, there is an internal function that is responsible for resizing, called resizeCheck(). However, this function is a private implementation and is not displayed to widgets as a public method.

You can get around this, though: since it resizeCheck()is called by the widget handler keyup, you can trigger this event yourself after setting a new value:

$("textarea").val(ajaxData).keyup();

, "".

+11
var offset=15;
$("textarea").val(ajaxData);
$("textarea").height($("textarea").innerHeight() + offset)

- , . ,

+1

You must specify the height: “auto” in the container element using CSS.

If you wrote a static height, it will not be automatic.

0
source

All Articles