LI に特定のテキストがあるかどうかを jQuery で確認し、それに応じてクラスを追加する必要があります。
これらの線に沿った何か...
if ($('ul li:last-child:contains("this text")').length > 0) {
$(this).addClass("this");
} else if ($('ul li:last-child:contains("that text")').length > 0)
$(this).addClass("that");
}
明らかに、上記のコードは機能しませんが、うまくいけば、私が必要としているものに近いものになります。誰が私がそれを書くことができるか知っていますか?
編集:以下のadeneoの回答のおかげで、私のために働いた正確なコードは次のとおりです...
$('.job-result .job-details ul li:last-child').addClass(function() {
return $(this).text().indexOf('Augusta') != -1 ? 'augusta' :
$(this).text().indexOf('Aiken') != -1 ? 'aiken' :
$(this).text().indexOf('Job') != -1 ? 'jobshop' : '';
});