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
Post a Comment