CSS选择器(id包含部分文本) [英] CSS selector (id contains part of text)
问题描述
我有一个问题。
我有这样的元素:
< a>
元素id = someGenerated一些:相同:0:name
< a>
元素id = someGenerated一些:相同:0: / p>
< a>
id = someGenerated的元素部分:相同:1:name
< a>
id = someGenerated的元素一些:相同:1:surname
我需要CSS选择器来获取名称。问题是,我不知道如何得到它。
我尝试了 a [id * ='Some:Same']
- 它返回所有< a>
元素。后我可以得到元素的id结束与名称。但我不喜欢这个想法。
尝试:
a [id * ='Some:Same'] [id $ ='name']
这将让你所有 a
元素的id包含
一些:相同
并且ID结尾为
名称
I have a question. I have elements something like this:
<a>
element with id = someGenerated Some:Same:0:name
<a>
element with id = someGenerated Some:Same:0:surname
<a>
element with id = someGenerated Some:Same:1:name
<a>
element with id = someGenerated Some:Same:1:surname
I need CSS selector to get names. The problem is that I don't know how to get it.
I tried a[id*='Some:Same']
- it returned all <a>
elements. After I can get elements which id ends with name. But I don't like this idea. I think that it can be done with some other selector.
Try this:
a[id*='Some:Same'][id$='name']
This will get you all a
elements with id containing
Some:Same
and have the id ending in
name
这篇关于CSS选择器(id包含部分文本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!