<table id="tab">
<tr><td class="click" id="111">111</td> <td id="222" class="click">222</td></tr>
<tr><td class="click" id="333">333</td> <td id="444" class="click">444</td></tr>
</table>
<div id="hidden">
text
</div>
#tab tr td {
padding: 10px;
border: solid 1px red;
}
#hidden {
background-color:green;
width: 40px;
height: 40px;
display: none;
}
$(".click").click(function(){
$("#hidden").show();
})
如何在當前點擊的TD中打開div #hidden?如果我點擊外面#隱藏我想隱藏這個div。打開當前點擊的TD div
小提琴:http://jsfiddle.net/QyRnH/2/
現在看http://jsfiddle.net/QyRnH/2/ – mgraph 2011-12-29 14:17:56