I have a table that has rows like:
<tr>
<td><input type="checkbox" /></td>
<td><a href="#">School</a></td>
<td><a href="#">DD1 1AB</a></td>
<td>80.10</td>
<td>200</td>
<td><span class="active">Active</span></td>
<td><a href="#">John Doe</a><br/>00000 000000</td>
</tr>
What I want to do is when a user has selected the checkbox is change the the class of the parent <tr> to say selected so the user knows which row they have selected. NOTE: They can toggle these on and off!
Assuming some of the checkboxed may come pre-checked, I’d take this approach:
Live demo: http://jsfiddle.net/cUxmG/
To reduce overheads of searching the DOM twice, that can be combined into:
It does the same thing: http://jsfiddle.net/cUxmG/2/