Fire change() event on Tickboxes

by ChrisStanyon

HTML

<table>
    <tr>
        <td><input type="checkbox" name="color[]" value="Red" />Red</td>
        <td><input type="checkbox" name="color[]" value="Green" checked />Green</td>
        <td><input type="checkbox" name="color[]" value="Blue" />Blue</td>
        <td><input type="checkbox" name="color[]" value="Yellow" checked />Yellow</td>
    </tr>
</table>

CSS

td {padding: 5px; }
.changed { background-color: red; }

JavaScript

$('input:checkbox').change(function(){
    $(this).parent('td').toggleClass('changed');
})