选择子ID包含XXX的标记 [英] select a tag that child's id contain XXX

查看:62
本文介绍了选择子ID包含XXX的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[ ^ ]大家好



我想选择一个标签,它的孩子的id包含XXX



例如,我有两个td tap







[^]Hi all

I want to select a tag that it's child's id contain XXX

for example, I have two td tap



<td><span id="BulletinGW_lbPostTime_0"></span></td>
<td><span id="XXXXXXXXXX"></span></td>







如何使用CSS选择一个td标签,其子跨度的id包含PostTime?



谢谢〜




how do I select a td tag that it's child span's id contain "PostTime" using CSS?

thanks~

推荐答案

我希望点按表示点击事件。所以你需要处理该控件的click事件。



选择具有所需id的span的td。然后触发此控件的click事件。

I hope that tap means click event. So you need to handle click event for that control.

Select the td which has a span with id required. Then trigger the click event of this control.


('td')。find('span [id * =PostTime ]')
('td').find('span[id*="PostTime"]')


好像你在询问CSS3中是否存在父选择器。



根据我目前的理解,它不存在,但很多人都希望如此。



请阅读以下内容



CSS中的父选择器: https://css-tricks.com/parent-selectors-in -css / [ ^ ]



但是CSS标准的下一次迭代可能会出现一些问题(但是我不会把手指交叉在那个上面)。

:具有Pseudo-Class,我们一直在等待的选择器: http://www.ericponto.com/blog/2015/01/10/has-pse udo-class-parent-selector / [ ^ ]



----------

如果你可以使用jQuery解决方案,你可以查看.parent和.has选择器。

jQuery .parent(): https://api.jquery.com/parent/ [ ^ ]

jQuery .has(): https://api.jquery.com/has/ [ ^ ]
It appears as though you are asking if a parent selector exists in CSS3.

From my current understanding, it does not exist, but many would like it.

Please read the following

Parent Selectors in CSS: https://css-tricks.com/parent-selectors-in-css/[^]

But something may come in the next iteration of the CSS stardards (but I would not keep my fingers crossed on that one).
The :has Pseudo-Class, the Selector We've Been Waiting For: http://www.ericponto.com/blog/2015/01/10/has-pseudo-class-parent-selector/[^]

----------
If you can use a jQuery solution, you could look into the .parent and .has selectors.
jQuery .parent(): https://api.jquery.com/parent/[^]
jQuery .has(): https://api.jquery.com/has/[^]


这篇关于选择子ID包含XXX的标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆