<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body> <div>
<ul>
<li>
<p>dhdhdh</p>
<div class="box">111111111111</div>
</li>
<li>
<p>没有box</p>
</li>
<li>
<p>dhdhdh</p>
<div class="box">22222222222222</div>
</li>
<li>
<p>dhdhdh</p>
<div class="box">33333333333</div>
</li>
</ul>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$('div li').each(function(){
//alert($(this).find("p").text());
$('div li').click(function(){
$('div li').children("div").show()
$(this).children('div').hide();
return false; //阻止事件冒泡到document
}) $(document).click(function(){
$('div li').children('div').show();
})
}); //备注也可以用e.target
</script>
</body>
</html>