日期:2014-05-16 浏览次数:20895 次
<style>
.selected {
background-color: red;
}
</style>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
$(function(){
$('#data tr').on('click', function() {
$(this).toggleClass('selected');
var checkBoxe = $(this).find("input");
checkBoxe.prop("checked", !checkBoxe.prop("checked"));
});
});
</script>
<table id='data'>
<tr><td><input type="checkbox" value="1"></td><td>eeeeeeeeeee</td></tr>
<tr><td><input type="checkbox" value=""></td><td>fffffffffff</td></tr>
<tr><td><input type="checkbox" value=""></td><td>ggggggggggg</td></tr>
</table>