I have this table that have rows with different classes and then checkboxes for buttons.
When I click one of the buttons, i.e. option1btn
, I want all the rows with the class option1
to be shown, if I click option2btn
, I want rows all with class option2
to be shown, and so on.
More then one buttons can be selected to show more then one options.
Here is a code example:
<input id="option1btn" type="checkbox">
<input id="option2btn" type="checkbox">
<input id="option3btn" type="checkbox">
<input id="option4btn" type="checkbox">
<table id="optionTable">
<tr class="option1">
<td></td>
</tr>
<tr class="option1">
<td></td>
</tr>
<tr class="option2 option4">
<td></td>
</tr>
<tr class="option1 option4">
<td></td>
</tr>
<tr class="option4">
<td></td>
</tr>
<tr class="option1 option3 option4">
<td></td>
</tr>
<tr class="option4">
<td></td>
</tr>
</table>
I currently use css to add different background color to odd/even rows. Would like that to work so that it applies the colors on the rows currently shown so I won't have two rows with the same color.