Reputation: 16303
I'm using a plugin (https://github.com/jaz303/jquery-grab-bag/blob/master/javascripts/jquery.autogrow-textarea.js) that dynamically resizes textareas.
To use it I do
$('textarea').autogrow()
when the document is ready.
However, it doesn't work on dynamically generated textareas retrieved by ajax calls. How can I automatically autogrow() new textareas?
Upvotes: 2
Views: 174
Reputation: 10598
typically you most likely will be appending the dynamic texareas
to some container, if that is true, just initialize the plugin to the container scope only:
$("textarea", container).autogrow();
assuming the container is the DOM
element with the dynamic textareas
Upvotes: 1
Reputation: 4926
In your ajax success event function put once again the $('textarea').autogrow()
after you place the text from request into page.
Upvotes: 2