jQuery: If character limit is "x" do "this"? -



jQuery: If character limit is "x" do "this"? -

i'm trying set class on div there's text inside, add together class if there's character count of 60.

so like, "if character count = 60 {" , i'll add together class. possible?

can utilize jquery filter() :

$(selector).filter(function(){ homecoming $(this).text().length >= 60; }).addclass('someclass');

filter() cut down elements defined in selector subset ( or none) match conditions returned callback

demo

jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -