【发布时间】:2011-02-13 16:34:11
【问题描述】:
我在我的应用程序上创建了一个表,代码相同
<table class="spreadsheet">
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
</table>
我使用以下 jQuery 代码通过单击选择一行
$("tr").click(function(){
$(this).toggleClass("otherstyle");
}
我的css是
tr.otherstyle td
{
background-color: #d1db3e;
color:#000;
}
我希望当我点击一行时,其他行未选中, 并且只选择一行。
我们如何创建它?
【问题讨论】:
标签: jquery html css html-table