$("#wrapper-noads > div > div > table .box-content > table tr").each(function(){ $(this).find('td').each(function(){ if (this.innerText.indexOf("Discontinued") !== -1){ $(this.parentElement).addClass("disc"); } }); }); $(".disc a").css('color', 'grey').css('font-style', 'italic'); $(".disc .smallfont").css('color', 'grey').css('font-style', 'italic');