I attempted to emphasize a row in a table using jQuery when the checkbox is checked. This is the jQuery code I used for this purpose:
$(":checkbox").change(function() {
$(this).closest("tr").toggleClass("highlight", this.checked);
});
However, it seems to be working only for every other row. To style the alternate rows in the table, I employed the following CSS:
.tables tbody tr:nth-child(2n){
background-color:#F9F9F9;
}
How can I also highlight the even rows?