Jquery:有头衔而不是单词

时间:2015-10-23 00:15:52

标签: jquery search

我如何为此选择JQUERY:

> git commit --allow-empty -m "YET-MORE-COMMENT"
[detached HEAD 4dd9e38] YET-MORE-COMMENT

> git status
rebase in progress; onto fcd827a
You are currently rebasing branch 'br_ysap' on 'fcd827a'.
  (all conflicts fixed: run "git rebase --continue")

nothing to commit, working directory clean

我可以选择所有带有此代码标题的图像:`

All images that have a title that does not have the word “dog” in it

我已经做到了这一点,但它不起作用:

$('img[title]')

1 个答案:

答案 0 :(得分:1)

尝试:

$('img[title]:not([title~="dog"])')

你很近但属性部分需要包含在[]

另一种方法是使用filter()

$('img[title]').filter(function(){
     return this.title.indexOf('dog') === -1;
});