0

I've seen this question, but mine is a little bit different.

Take the following HTML:

<tr>
  <td>
    <select id="show">
      <option>Show</option>
      <option>Don't show</option>
    </select>
  </td>
</tr>

<tr class="basedOnSelect">
  <!-- stuff here -->
</tr>

As implied, I want to show the second tr based on which option is selected in the show select element. I can do this in JavaScript, but I have seen little CSS hacks to do similar things based on check boxes in pure CSS.

The problem in my case appears to be that the select is too far down the tree to use sibling selectors to get the desired tr, and there is still no "parent" selector to use.

Is this possible?

2mac
  • 1,609
  • 5
  • 20
  • 35
  • Not do-able with css - there is no parent selector. Things done with checkboxes are usually done with the checkbox being a sibling of what it is changing – Pete Mar 12 '19 at 15:38
  • The one-column table is just for illustration purposes. In my real application there are many columns. – 2mac Mar 12 '19 at 15:42

0 Answers0