Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
[^]Hi all

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

for example, I have two td tap



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



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

thanks~
Posted
Updated 16-Oct-15 7:34am
v4
Comments
jaket-cp 16-Oct-15 12:19pm    
Am I missing something, what is a tap in this context?
KE JJ 16-Oct-15 13:34pm    
sorry, it's tag not tap

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"]')
 
Share this answer
 
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/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900