【发布时间】:2013-03-01 07:17:52
【问题描述】:
我有一个这样的表格:
<table id="example">
<thead>
<tr>
<th>Header1</th>
<th>Header2</th>
<th>Header3</th>
</tr>
</thead>
<tbody>
<tr>
<td>some php to get custom field</td>
<td>also custom field- the loop is above so this is working as it should</td>
<td>
<a href="#" class="showhide">
<div class="more">
.. the content I want to show when user clicks a class="showhide"
</div>
</a>
</td>
<tr>
</tbody>
</table>
我尝试使用 jQuery 来实现,但没有任何反应。这是我试过的 jQuery:
$(function () {
$('.showhide').click(function () {
$(this).next().toggle()
});
});
我也使用document.ready 实现了它,但仍然无法正常工作。有没有其他方法可以做到这一点?
我想要的只是将 div class="more" 的内容显示在表格中的行下方(并且在下一个之前),当然,当单击 class="showhide" 时。
我将它与插件 DataTables 一起使用,但这不会导致问题。
【问题讨论】:
标签: javascript jquery jquery-plugins html-table show-hide