Reputation: 5327
I am using following code
$(document).ready(function() {
$(".text_message").autosize();
}
for autosizing the text box. My problem is this is not working for dynamically added text boxes. How to resolve this?
Upvotes: 0
Views: 47
Reputation: 592
try
$( document ).ajaxComplete(function() {
$(".text_message").autosize();
});
Upvotes: 0
Reputation: 4517
Because the script runs on $(document).ready
it will only work for elements that exist when your page loads.
You need to use something like the on
method on the parent so that elements added after are also affected.
Another good reference: Event binding on dynamically created elements?
Upvotes: 1