【发布时间】:2010-10-01 01:53:14
【问题描述】:
我有这样的事情:
<div class="content">
<a href="#">A</a>
</div>
<div class="content">
<a href="#">B</a>
</div>
<div class="content">
<a href="#">C</a>
</div>
当单击这些链接之一时,我想对未单击的链接执行 .hide() 函数。我知道 jQuery 有 :not 选择器,但我不知道在这种情况下如何使用它,因为 我必须使用 $(".content a")
我想做类似的事情
$(".content a").click(function()
{
$(".content a:not(this)").hide("slow");
});
但我不知道在这种情况下如何正确使用 :not 选择器。
【问题讨论】:
-
尝试
!$(this)以获得更简单的代码。
标签: jquery jquery-selectors this