html - CSS checkbox:checked not working -


i trying checkboxes change color of text within tabel, doesn't seem working. :checked attribute doesn't seem working. text in . code follows:

<html> <head> <style type="text/css"> .methodoption {  } #row1 {     color: blue; } #buyer1 + #row1 {     color: blue; }  #buyer1 input[type=checkbox]:checked ~ #row1 {     color: red; }  </style> </head> <body> <div align="justify" style="font-size: 23px;">                                  social compliance has changed lot on past few years. several high-profile industry disasters in key sourcing countries bangladesh, along heightened awareness among consumers clothes come from, has prompted stakeholders across supply chain, production facilities brands , buyers, rethink approach compliance , supply chain security. part of our commitment being responsive , effective social compliance monitoring partner, @ wrap wanted idea of of these changes , how can adapt our own program better meet needs.</div><br/> <div align="center" style="font-size: 29px;">we talked <strong>50</strong> buyers, thought leaders,<br/>and other stakeholders in social compliance arena</div> <div align="center"><img src="infogfx.png" height="350" width="900"></div><br/><br/> <table align="center" width="600" style="background-color: #aaaaaa;"><tr><td align="center"><em><strong style="font-size: 25px;">who they?</strong></em></td></td> <tr><td>in exchange participation in survey, have agreed keep identities of particiapted anonymous.</td></tr><table>  <form action="" method="post"> <table> <tr><td><input type="checkbox" name="buyer1" id="buyer1"></td><td>1</td><td class="methodoption"><span id="row1">stakeholder expectations</span></td></tr> <tr><td><input type="checkbox" name="buyer2a" id="buyer2a"></td><td>2(tie)</td><td class="methodoption">factory compliance/strengthen supply chain</td></tr> <tr><td><input type="checkbox" name="buyer2b" id="buyer2b"></td><td>2(tie)</td><td class="methodoption">corporate philosophy</td></tr> <tr><td><input type="checkbox" name="buyer4" id="buyer4"></td><td>4</td><td class="methodoption">integrity of brand</td></tr> <tr><td><input type="checkbox" name="buyer5a" id="buyer5a"></td><td>5(tie)</td><td class="methodoption">risk management</td></tr> <tr><td><input type="checkbox" name="buyer5b" id="buyer5b"></td><td>5(tie)</td><td class="methodoption">right thing do</td></tr> </table></form>  </body> </html> 

the general sibling selector ~, name suggests, selects siblings. siblings elements found within same parent. input element isn't under same td #row1 element, , therefore isn't selectable.

for work you'd need contain #row1 element within same td input element:

<td>     <input type="checkbox" ... />     <span id="row1"> ... </span> </td> 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -