【发布时间】:2014-11-25 10:03:48
【问题描述】:
这就是我正在做的......它的分类表,当单击按钮时显示有关否则保持隐藏的详细信息,CSS 对我有好处,问题是当我单击按钮显示 tbody 时没有任何反应,无法获取它出什么问题了。看看我的代码..
css 让他隐藏,除非他没有被点击,
.down1 {
display: none;
}
$(document).ready(function(){
$("#show1").click(function(){
$(".down1").toggle();
});
});
<table align="center" cellpadding="10" width="300">
<tr>
<th bgcolor="brown"></th>
<th bgcolor="brown">Day</th>
<tr>
<td align="center" bgcolor="lightgrey">
<input type="button" value="+" id="show1" />
</td>
<td align="center" bgcolor="lightgrey">Monday</td>
<tbody class="down1">
<tr>
<td>
<input type="checkbox" />
</td>
<td>9:00 -10:00 (time) </td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td>9:00 -10:00 (time)</td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td>9:00 -10:00 (time)</td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td>9:00 -10:00 (time)</td>
</tr>
<tr>
<td>
<input type="checkbox" />
</td>
<td>9:00 -10:00 (time)</td>
</tbody>
</tr>
</tr>
</table>
【问题讨论】:
-
你必须更正:
.down { display:none; }到.down1 { display:none; } -
抱歉我的错误是
.down1css 运行良好,jquery 无法运行 -
您的 HTML 存在 很多 语法问题;未关闭的
tr,以及错误放置的tr和tbody。 -
是的,他们肯定是错误,我会修复它..
标签: javascript jquery html css