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

Recommended Answers

All 3 Replies

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.

thanks for all,Its done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.