Can anyone tell me how to write each function for ajax loaded elements

Ex:Refer the code below

$('textarea').each(function () {
        $(this).attr('maxlength', 150).addClass('characterCount');

      }) 

This code working fine, how to make it work in ajax loaded elments

Member Avatar

Can you please explain more? What is wrong with a for loop (it'll be faster)? Is the AJAX returning JSON? Please give as much information as possible.

Hey stbuchok,

Thanks for your response, we are appending character count using jquery next to the "textarea" field,when the user start typing the post.

Now the problem is , It is working in fine in the default textarea field,but when more post is loading through ajax.This character count is not appending to them.Hope now u understand.