好吧,在看了很多关于 SO 的帖子之后,我仍然无法找到我要去的地方。我的代码没有变化。它仍然显示每个数据。我希望<div class="span9">
在选择链接时隐藏数据<div class="span3">
我哪里错了?
<div class="row">
<div class="span9" id = "4_2">
hello<br>
How are you????
2013-08-06 14:33:16
</div> <!--end of div class span9 -->
<div class="span3">
<a href="#" class = "dropdown-link">mithila</a>
<div> <!--end of div span3-->
<div class="span9" id = "1_1">
My name is praful<br>
2013-08-06 14:22:17
</div> <!--end of div class span9 -->
<div class="span3">
<a href="#" class = "dropdown-link">mithila</a>
</div> <!--end of div span3-->
</div><!--end of div row-->
jQuery
$(document).ready(function(){
$('div.row').each(function() {
var $dropdown = $(this);
$("a.dropdown-link", $dropdown).click(function(e) {
e.preventDefault();
$div = $("div.span9", $dropdown);
$div.toggle();
$("div.span9").not($div).hide();
return false;
});
});
$('html').click(function(){
$("div.span9").hide();
});
});