Attack css in the parent element

Asked

Viewed 48 times

0

I have this HTML structure:

<table>
  <tr>
    <th>Firstname</th>
    <th><a>Lastname</a></th> 
    <th>Age</th>
  </tr>
  <tr>
    <th>Firstname</th>
    <th>Lastname</th> 
    <th>Age</th>
  </tr>
</table>

I needed to apply CSS to <tr> of all elements having the element <a>. Does anyone know if you can do this in CSS?

  • It doesn’t work :( I had already tried

  • Want to use css only?

  • @Nagi can use Jquery?

  • not pq I would have to redo the function of the framework and put a Calback there would have problems ahead with updates.. am tempted with CSS I tried to put an onload on the element anything else :(

  • can tell me if there is a function in JQUERY that monitors html because it is added via $('table tbody'). html(RETURN); and I didn’t want to touch the framework

  • Take a look here https://stackoverflow.com/questions/15657686/jquery-event-detect-changes-to-the-html-text-of-a-div

  • If you have a <a> inside the <th> do you want the <tr> to get a style is that it? Or do you want to style all the <a> inside the table? Currently only with CSS you can not change the Father’s style through the web.

  • $('body'). on('Domsubtreemodified', 'table tbody tr', Function(){ // do your Stuff if($(this). find('. active'). length) { $(this). addClass('active_tr'); } }); @N.Days

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.