Specify one Checkbox to make a selected Row

by Akram kamal

HTML

<table id="candy" >
	<tr id="dd">
		<th><input type="checkbox" id="bbbbbb" /></th>
		<th width="20">a</th>
		<th width="20">b</th>
		<th width="20">c</th>
		<th width="20">d</th>
		<th width="20">e</th>
		<th width="20">f</th>
		<th width="20">g</th>
		<th width="20">h</th>
	</tr>
	<tr>
		<td><input type="checkbox" class="asdf"  /></td>
		<td>v</td>
		<td>v</td>
		<td>v</td>
		<td>v</td>
		<td>v</td>
		<td>v</td>
		<td>v</td>
		<td><input type="checkbox" /></td>
		<td><input type="checkbox" /></td>                                 
	</tr>
	<tr>
		<td><input type="checkbox" class="asdf"  /></td>
		<td>e</td>
		<td>e</td>
		<td>e</td>
		<td>e</td>
		<td>e</td>
		<td>e</td>
		<td>e</td>
		<td><input type="checkbox" /></td>
		<td><input type="checkbox" /></td>                                  
	</tr>
    <tr>
		<td><input type="checkbox" class="asdf"  /></td>
		<td>q</td>
		<td>q</td>
		<td>q</td>
		<td>q</td>
		<td>q</td>
		<td>q</td>
		<td>q</td>
		<td><input type="checkbox" /></td>
		<td><input type="checkbox" /></td>                                  
	</tr>
</table>

CSS

tr.selected {
      background-color: #FEF0BF;
    }

JavaScript

$("#candy .asdf").on("change", function() {
  $(this).closest("tr").toggleClass('selected', this.checked)
});