2015-10-14 95 views

回答

2

写自己的过滤功能,以严格的比较:

$('.notice').filter(function() { 
    return $.text(this) === '2 minutes'; 
}).addClass('highlight'); 

如果所需的文本位于其他文本中,你可以使用正则表达式来测试的有效性,例如/\b2 minutes\b/.test($.text(this))