user1844039
user1844039

Reputation: 133

how to make dynamic textarea autogrow on typing?

I am creating textareas dynamically in jquery mobile. But the problem is dynamic textarea doesnt grow automatically on typing while the textarea created statically is autogrowing on typing.. can someone tell me how to implement autogrowing of dynamically created textareas. Thanks in advance

Upvotes: 0

Views: 497

Answers (2)

user700284
user700284

Reputation: 13620

Try using this just after you add the textarea to the DOM:

$("#pageId").trigger('create');//id of the the data-role="page" div in which you are dynamically adding the texarea.

Upvotes: 1

Matt Gibson
Matt Gibson

Reputation: 14949

You can use the jQuery autogrow plugin for this.

$(function() {
    $('#yourtextarea').autogrow();
});

Upvotes: 0

Related Questions