Here\'s an example of my problem on jsFiddle.
I have a table with striped rows imposed by using tr:nth-child(odd) in the CSS, as is done in Twitter Boot
http://jsfiddle.net/iambriansreed/xu2AH/9/
.table-striped class
.table-striped tbody tr.highlight td { background-color: red; }
... and cleaner jQuery:
$('#mytable tbody tr').live('click', function(event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
});
Update: .live() has since been deprecated. Use .on().
$('#mytable').on('click', 'tbody tr', function(event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
});
Fixed: http://jsfiddle.net/iambriansreed/xu2AH/127/