【发布时间】:2013-02-01 07:09:02
【问题描述】:
如果单击任何行,我的以下代码可以正常工作:
$(document).ready(function() {
$('#currentloc_table tr').click(function(event) {
$("#"+$(this).attr('id')+" input:checkbox")[0].checked = ! ($("#"+$(this).attr('id')+" input:checkbox")[0].checked);
if($("#"+$(this).attr('id')+" input:checkbox")[0].checked == true)
$(this).addClass('selected');
else if($("#"+$(this).attr('id')+" input:checkbox")[0].checked == false)
$(this).removeClass('selected');
});
});
这是 CSS:
.selected td {
background: yellow;
}
我需要在页面加载时,此表的第一行应突出显示。我该怎么做?
【问题讨论】:
-
对我有用吗...??@Nida Sulheri
标签: javascript jquery html syntax-highlighting highlight