How to add a class to a string with characters longer than...
Hello,
here is what I have so far. The problem is that, my class is added to every instance even if characters count is less than 50. What is wrong here. I will appreciate your help.
- var slideTxt = $('.homepage-two-column .jcarousel-wrapper.slideshow .slide .caption .inner .desc h2 a');
$(slideTxt).each(function(i) {
var iTotalWords = $(this).text().length;
console.log(iTotalWords);
if(iTotalWords > 50){
slideTxt.addClass('Class60');
}
});
})