我有下表在单击标题时展开/折叠。但是,无论我将它们添加多少次,表行中的链接都会被删除。下面是我的表格的HTML:
<table border="0">
<tbody>
<tr class="header">
<td>Header</td>
</tr>
<tr>
<td><a href="http://www.google.com">Data Row 1 Goes Here...</a></td>
</tr>
<tr>
<td>Data Row 2 Goes Here...</td>
</tr>
<tr>
<td>Data Row 3 Goes Here...</td>
</tr>
<tr>
<td>Data Row 4 Goes Here...</td>
</tr>
<tr>
<td>Data Row 5 Goes Here...</td>
</tr>
<tr class="header">
<td>Header</td>
</tr>
<tr>
<td>Data Row 1 Goes Here...</td>
</tr>
<tr>
<td>Data Row 2 Goes Here...</td>
</tr>
<tr>
<td>Data Row 3 Goes Here...</td>
</tr>
<tr>
<td>Data Row 4 Goes Here...</td>
</tr>
<tr>
<td>Data Row 5 Goes Here...</td>
</tr>
<tr class="header">
<td>Header</td>
</tr>
<tr>
<td>Data Row 1 Goes Here...</td>
</tr>
<tr>
<td>Data Row 2 Goes Here...</td>
</tr>
<tr>
<td>Data Row 3 Goes Here...</td>
</tr>
<tr>
<td>Data Row 4 Goes Here...</td>
</tr>
<tr>
<td>Data Row 5 Goes Here...</td>
</tr>
</tbody>
</table>
这是我的剧本:
<script
$(document).ready(function()
{
$('.RowToClick').click(function ()
{
$(this).nextAll('tr').each( function()
{
if ($(this).is('.row'))
{ return false;
}
$(this).toggle(350);
};
);
);
</script>