The purpose of my codes is to change the <td>
portion of the color and the font inside the table when I check/unchecked the box, but it didn't work as intended with the code I got from here.
input[type=checkbox] + td {
background-color: #FFFFFF;
color:#000000
}
input[type=checkbox]:checked + td {
background-color: #00447C;
color:#FFFFFF;
}
<div id="details">
<div class="container">
<p>Example</p>
<table id="table">
<tr>
<th></th>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td> <input type="checkbox"/></td>
<td>element1</td>
<td>detail1</td>
</tr>
<tr>
<td> <input type="checkbox"/></td>
<td>element2</td>
<td>detail2</td>
</tr>
<tr>
<td> <input type="checkbox"/></td>
<td>element3</td>
<td>detail3</td>
</tr>
</table>
<button class="button">Reset</button>
</div>
</div>
It works in the source so I am confused regarding this.
Aucun commentaire:
Enregistrer un commentaire