我有下一个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 () {
}
但它不起作用。
任何帮助表示赞赏!
答案 0 :(得分:3)
试试这个:
$('li:contains("was Approved"):contains("your ad")')
在你的情况下它会像这样:
$("#notification-list").find(
"li:contains('was Approved'):contains('your ad')).each(function () {
}
答案 1 :(得分:1)
试试这个
$("#notification-list li:contains('was Approved')").not(":contains('your ad')")