我有一个突出显示表中每一行的功能(css代码)
.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>
仅在表脚的最后一行有效,我希望它是另一种颜色(红色)。
我怎样才能做到这一点?我制作了一个http://jsfiddle.net/pd981Lps/,对我的代码进行了一些更改以使阅读更容易。
将选择器更改为target tbody
:$("#table-example-1 tbody tr")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句