【发布时间】:2009-09-18 01:17:39
【问题描述】:
当您单击 build_files_toggld 在它上面分类链接。我可以用 $(this).parent().parent().next().slideToggle(30) 让下一行折叠,但是当我添加“.build_files_toggle”时它不起作用......而且它是杀了我。我什至试过 $(this).parent().parent().next().children('.build_files_toggle').slideToggle(30); 但没有运气!这里的任何想法都会很棒。
即使是关于所有 jquery 选择器的非常好的教程也会很好!
$(".build_files_toggle").click(function()
{
$(this).parent().parent().next('.build_files_toggle').slideToggle(30);
});
<div class="buildGroup" id="RecentBuilds">
<table>
<tr>
<th>
Build Date
</th>
<th>
Built By
</th>
</tr>
<tr>
<td>
Aug 22nd 3:11 pm
</td>
<td>
<a href="#" class="build_files_toggle" >View</a>
</td>
</tr>
<tr>
<td colspan="2">
<div id="build_files1" class="infoBox_build_files">
This is a block of text. This is a block of text. This is a block of text. This is a block of text. This is a block of text. This is a block of text. This is a block of text. This is a block of text.
</div>
</td>
</tr>
</table>
【问题讨论】:
-
这是一个很好的选择器参考refcardz.dzone.com/refcardz/jquery-selectors 这是迄今为止我发现的最有用的一个 jquery 参考visualjquery.com
-
查看我修改后的答案。 build_files1 是一个 ID,而不是一个类。
标签: jquery