标签: jquery
答案 0 :(得分:3)
您可以像这样使用:contains选择器:
$('a:contains("Home")') //contains "Home" ? .parent()//select its parent 'li' .addClass('active');//add class 'active' to 'li'