Reputation: 499
I have a function that highlights each row in a table (css code)
.stripe1 {
background-color:#999999;
}
.stripe2 {
background-color:#666666;
}
.highlight {
background-color: #ffcc66;
font-weight:bold;
}
<script type="text/javascript">
$(function() {
$("#table-example-1 tr:even").addClass("stripe1");
$("#table-example-1 tr:odd").addClass("stripe2");
$("#table-example-1 tr").hover(
function() {
$(this).toggleClass("highlight");
},
function() {
$(this).toggleClass("highlight");
}
);
});
</script>
It works great only the last line in the table the tfoot I would like it to be a different color(red).
How would I be able to accomplish this ? I made a http://jsfiddle.net/pd981Lps/ , change my code a little bit to make think easier to read.
Upvotes: 1
Views: 22
Reputation: 92983
Change your selectors to target tbody
: $("#table-example-1 tbody tr")
Upvotes: 4