1

我有下一个 li-s:

your ad was Approved
your name was Approved
your ad was Deleted

我想通过这两个条件找到:

我尝试了下一件事:

$("#notification-list").find(
"li:contains('was Approved'), li:not(:contains('your ad'))).each(function () {

}

但我得到了:

your ad was Approved (I got it cause 'your ad' is found here and 'was Approved')
your name was Approved (I got it cause 'was Approved' is found)
your ad was Deleted (I got it cause 'your ad' is found)

我只想获取包含这两种东西的项目:

your ad was Approved (I got it cause 'your ad' is found here and 'was Approved')

我试过:

$("#notification-list").find(
"li:contains('was Approved') and li:not(:contains('your ad'))).each(function () {

}

但它不起作用。

任何帮助表示赞赏!

4

2 回答 2

3

试试这个:

$('li:contains("was Approved"):contains("your ad")')

它在你的情况下是这样的:

$("#notification-list").find(
    "li:contains('was Approved'):contains('your ad')).each(function () {

}
于 2013-08-20T12:31:01.277 回答
1

试试这个

$("#notification-list li:contains('was Approved')").not(":contains('your ad')")
于 2013-08-20T12:34:36.977 回答