【发布时间】:2014-06-08 13:15:34
【问题描述】:
我在包含文本的文档中找到所有 div:“thetext”,我正在更改此文本:
$("div:contains('thetext'):not(:has(*))").each(function () {
$(this).text($(this).text() + " anotherTextAddedBefore");
})
是否可以在里面放多个值? 我想找到包含:'thetext',还有其他值的 div,例如:'thetext1'、'thetext2'等
我想在一个过程中完成,而不是更多:不想使用与我想查找的文本一样多的过程。
谢谢!
【问题讨论】:
-
$("div:contains('thetext'), div:contains('thetext1'), div:contains('thetext2')")是可能的 -
$("div:contains('thetext'):contains('thetext1'):contains('thetext2')") -
这不是与条件@A.Wolff 吗?
-
@JayBlanchard 是的,但这就是我理解问题的方式,我可能错了
I would like to find the divs whic contains: 'thetext', but also another values, for example: 'thetext1', 'thetext2',etc -
啊,重读我明白你在说什么@A.Wolff
标签: javascript jquery contains