【发布时间】:2014-04-19 01:31:08
【问题描述】:
我正在尝试从 JS Fiddle link 复制您上面的解决方案,但无法加载它。 我错过了什么?
我正在尝试从这个question 实施解决方案。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style>
.table-striped tr.highlight td {
background-color: blue;
color:white;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$('#mytable').on('click', 'tbody tr', function(event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
});
</script>
</head>
<body>
<table id="mytable" class="table-striped">
<tr><td>blah blah blah blah</td></tr>
<tr><td>blah blah blah blah</td></tr>
<tr><td>blah blah blah blah</td></tr>
<tr><td>blah blah blah blah</td></tr>
<tr><td>blah blah blah blah</td></tr>
</table>
</body>
</html>
【问题讨论】:
标签: javascript jquery html